From cad617bba054334e2172b9ef54f2ed82c6067794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Mon, 15 Mar 2021 10:15:08 +0100 Subject: 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 --- crates/hir_expand/src/builtin_derive.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/hir_expand') 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 { } fn make_type_args(n: usize, bound: Vec) -> Vec { - let mut result = Vec::::new(); + let mut result = Vec::::with_capacity(n * 2); result.push( tt::Leaf::Punct(tt::Punct { char: '<', -- cgit v1.2.3