diff options
author | uHOOCCOOHu <[email protected]> | 2019-10-02 19:02:53 +0100 |
---|---|---|
committer | uHOOCCOOHu <[email protected]> | 2019-10-02 19:28:03 +0100 |
commit | 1067a1c5f649cc206e35b427eaa8d6553280cc96 (patch) | |
tree | e55b3e9ad4b2ece335f5660712918b6b97390bd3 /crates/ra_cfg | |
parent | e0100e63ae2e873f119b905ac77c3355ffb351b0 (diff) |
Read default cfgs from rustc
Diffstat (limited to 'crates/ra_cfg')
-rw-r--r-- | crates/ra_cfg/src/lib.rs | 10 |
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 |
2 | use std::iter::IntoIterator; | ||
3 | |||
2 | use ra_syntax::SmolStr; | 4 | use ra_syntax::SmolStr; |
3 | use rustc_hash::FxHashSet; | 5 | use 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 |