mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Move feature desugaring to the right abstraction layer
This commit is contained in:
parent
7be0a29c63
commit
d3110859ba
2 changed files with 12 additions and 18 deletions
|
@ -2,8 +2,6 @@
|
|||
|
||||
mod cfg_expr;
|
||||
|
||||
use std::iter::IntoIterator;
|
||||
|
||||
use ra_syntax::SmolStr;
|
||||
use rustc_hash::FxHashSet;
|
||||
|
||||
|
@ -48,18 +46,4 @@ impl CfgOptions {
|
|||
pub fn insert_key_value(&mut self, key: SmolStr, value: SmolStr) {
|
||||
self.key_values.insert((key, value));
|
||||
}
|
||||
|
||||
/// Shortcut to set features
|
||||
pub fn insert_features(&mut self, iter: impl IntoIterator<Item = SmolStr>) {
|
||||
iter.into_iter().for_each(|feat| self.insert_key_value("feature".into(), feat));
|
||||
}
|
||||
|
||||
/// Shortcut to set cfgs
|
||||
pub fn insert_cfgs(&mut self, iter: impl IntoIterator<Item = SmolStr>) {
|
||||
iter.into_iter().for_each(|cfg| match cfg.find('=') {
|
||||
Some(split) => self
|
||||
.insert_key_value(cfg[0..split].into(), cfg[split + 1..].trim_matches('"').into()),
|
||||
None => self.insert_atom(cfg),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue