aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand/src
diff options
context:
space:
mode:
authorMatthias Krüger <[email protected]>2021-03-15 09:15:08 +0000
committerMatthias Krüger <[email protected]>2021-03-15 09:19:59 +0000
commitcad617bba054334e2172b9ef54f2ed82c6067794 (patch)
tree3c124ef8606b985353de946245498babe5d7c6a0 /crates/hir_expand/src
parentde360275416ca095102f2b17d6ca1de3bd091fdb (diff)
some clippy::performance fixes
use vec![] instead of Vec::new() + push() avoid redundant clones use chars instead of &str for single char patterns in ends_with() and starts_with() allocate some Vecs with capacity to avoid unneccessary resizing
Diffstat (limited to 'crates/hir_expand/src')
-rw-r--r--crates/hir_expand/src/builtin_derive.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/hir_expand/src/builtin_derive.rs b/crates/hir_expand/src/builtin_derive.rs
index dfdb9cf59..5e908b223 100644
--- a/crates/hir_expand/src/builtin_derive.rs
+++ b/crates/hir_expand/src/builtin_derive.rs
@@ -108,7 +108,7 @@ fn parse_adt(tt: &tt::Subtree) -> Result<BasicAdtInfo, mbe::ExpandError> {
108} 108}
109 109
110fn make_type_args(n: usize, bound: Vec<tt::TokenTree>) -> Vec<tt::TokenTree> { 110fn make_type_args(n: usize, bound: Vec<tt::TokenTree>) -> Vec<tt::TokenTree> {
111 let mut result = Vec::<tt::TokenTree>::new(); 111 let mut result = Vec::<tt::TokenTree>::with_capacity(n * 2);
112 result.push( 112 result.push(
113 tt::Leaf::Punct(tt::Punct { 113 tt::Leaf::Punct(tt::Punct {
114 char: '<', 114 char: '<',