mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Replace some String usages with SmolStr in completions
This commit is contained in:
parent
439a8194b0
commit
2f5afba9f8
18 changed files with 99 additions and 111 deletions
|
@ -66,24 +66,21 @@ impl CfgOptions {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_cfg_keys(&self) -> Vec<&SmolStr> {
|
||||
self.enabled
|
||||
.iter()
|
||||
.map(|x| match x {
|
||||
CfgAtom::Flag(key) => key,
|
||||
CfgAtom::KeyValue { key, .. } => key,
|
||||
})
|
||||
.collect()
|
||||
pub fn get_cfg_keys(&self) -> impl Iterator<Item = &SmolStr> {
|
||||
self.enabled.iter().map(|x| match x {
|
||||
CfgAtom::Flag(key) => key,
|
||||
CfgAtom::KeyValue { key, .. } => key,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_cfg_values(&self, cfg_key: &str) -> Vec<&SmolStr> {
|
||||
self.enabled
|
||||
.iter()
|
||||
.filter_map(|x| match x {
|
||||
CfgAtom::KeyValue { key, value } if cfg_key == key => Some(value),
|
||||
_ => None,
|
||||
})
|
||||
.collect()
|
||||
pub fn get_cfg_values<'a>(
|
||||
&'a self,
|
||||
cfg_key: &'a str,
|
||||
) -> impl Iterator<Item = &'a SmolStr> + 'a {
|
||||
self.enabled.iter().filter_map(move |x| match x {
|
||||
CfgAtom::KeyValue { key, value } if cfg_key == key => Some(value),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue