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/project_model/src/rustc_cfg.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/project_model/src') diff --git a/crates/project_model/src/rustc_cfg.rs b/crates/project_model/src/rustc_cfg.rs index 4a7bd8ae3..312708575 100644 --- a/crates/project_model/src/rustc_cfg.rs +++ b/crates/project_model/src/rustc_cfg.rs @@ -6,7 +6,7 @@ use crate::{cfg_flag::CfgFlag, utf8_stdout}; pub(crate) fn get(target: Option<&str>) -> Vec { let _p = profile::span("rustc_cfg::get"); - let mut res = Vec::new(); + let mut res = Vec::with_capacity(6 * 2 + 1); // Some nightly-only cfgs, which are required for stdlib res.push(CfgFlag::Atom("target_thread_local".into())); -- cgit v1.2.3