mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Read default cfgs from rustc
This commit is contained in:
parent
e0100e63ae
commit
1067a1c5f6
8 changed files with 76 additions and 14 deletions
|
@ -1,4 +1,6 @@
|
|||
//! ra_cfg defines conditional compiling options, `cfg` attibute parser and evaluator
|
||||
use std::iter::IntoIterator;
|
||||
|
||||
use ra_syntax::SmolStr;
|
||||
use rustc_hash::FxHashSet;
|
||||
|
||||
|
@ -44,6 +46,14 @@ impl CfgOptions {
|
|||
self
|
||||
}
|
||||
|
||||
/// Shortcut to set features
|
||||
pub fn features(mut self, iter: impl IntoIterator<Item = SmolStr>) -> CfgOptions {
|
||||
for feat in iter {
|
||||
self = self.key_value("feature".into(), feat);
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
pub fn remove_atom(mut self, name: &SmolStr) -> CfgOptions {
|
||||
self.atoms.remove(name);
|
||||
self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue