aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cfg
diff options
context:
space:
mode:
authoruHOOCCOOHu <[email protected]>2019-10-02 19:02:53 +0100
committeruHOOCCOOHu <[email protected]>2019-10-02 19:28:03 +0100
commit1067a1c5f649cc206e35b427eaa8d6553280cc96 (patch)
treee55b3e9ad4b2ece335f5660712918b6b97390bd3 /crates/ra_cfg
parente0100e63ae2e873f119b905ac77c3355ffb351b0 (diff)
Read default cfgs from rustc
Diffstat (limited to 'crates/ra_cfg')
-rw-r--r--crates/ra_cfg/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_cfg/src/lib.rs b/crates/ra_cfg/src/lib.rs
index dd81a73f4..e1c92fbba 100644
--- a/crates/ra_cfg/src/lib.rs
+++ b/crates/ra_cfg/src/lib.rs
@@ -1,4 +1,6 @@
1//! ra_cfg defines conditional compiling options, `cfg` attibute parser and evaluator 1//! ra_cfg defines conditional compiling options, `cfg` attibute parser and evaluator
2use std::iter::IntoIterator;
3
2use ra_syntax::SmolStr; 4use ra_syntax::SmolStr;
3use rustc_hash::FxHashSet; 5use rustc_hash::FxHashSet;
4 6
@@ -44,6 +46,14 @@ impl CfgOptions {
44 self 46 self
45 } 47 }
46 48
49 /// Shortcut to set features
50 pub fn features(mut self, iter: impl IntoIterator<Item = SmolStr>) -> CfgOptions {
51 for feat in iter {
52 self = self.key_value("feature".into(), feat);
53 }
54 self
55 }
56
47 pub fn remove_atom(mut self, name: &SmolStr) -> CfgOptions { 57 pub fn remove_atom(mut self, name: &SmolStr) -> CfgOptions {
48 self.atoms.remove(name); 58 self.atoms.remove(name);
49 self 59 self