mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
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
This commit is contained in:
parent
de36027541
commit
cad617bba0
9 changed files with 13 additions and 19 deletions
|
@ -6,7 +6,7 @@ use crate::{cfg_flag::CfgFlag, utf8_stdout};
|
|||
|
||||
pub(crate) fn get(target: Option<&str>) -> Vec<CfgFlag> {
|
||||
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()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue