aboutsummaryrefslogtreecommitdiff
path: root/crates/project_model/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/project_model/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/project_model/src')
-rw-r--r--crates/project_model/src/rustc_cfg.rs2
1 files changed, 1 insertions, 1 deletions
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};
6 6
7pub(crate) fn get(target: Option<&str>) -> Vec<CfgFlag> { 7pub(crate) fn get(target: Option<&str>) -> Vec<CfgFlag> {
8 let _p = profile::span("rustc_cfg::get"); 8 let _p = profile::span("rustc_cfg::get");
9 let mut res = Vec::new(); 9 let mut res = Vec::with_capacity(6 * 2 + 1);
10 10
11 // Some nightly-only cfgs, which are required for stdlib 11 // Some nightly-only cfgs, which are required for stdlib
12 res.push(CfgFlag::Atom("target_thread_local".into())); 12 res.push(CfgFlag::Atom("target_thread_local".into()));