aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cfg
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_cfg')
-rw-r--r--crates/ra_cfg/src/lib.rs24
1 files changed, 9 insertions, 15 deletions
diff --git a/crates/ra_cfg/src/lib.rs b/crates/ra_cfg/src/lib.rs
index e1c92fbba..1bee3eb99 100644
--- a/crates/ra_cfg/src/lib.rs
+++ b/crates/ra_cfg/src/lib.rs
@@ -36,26 +36,20 @@ impl CfgOptions {
36 self.check(&parse_cfg(attr)) 36 self.check(&parse_cfg(attr))
37 } 37 }
38 38
39 pub fn atom(mut self, name: SmolStr) -> CfgOptions { 39 pub fn insert_atom(&mut self, key: SmolStr) {
40 self.atoms.insert(name); 40 self.atoms.insert(key);
41 self
42 } 41 }
43 42
44 pub fn key_value(mut self, key: SmolStr, value: SmolStr) -> CfgOptions { 43 pub fn remove_atom(&mut self, name: &str) {
45 self.key_values.insert((key, value)); 44 self.atoms.remove(name);
46 self
47 } 45 }
48 46
49 /// Shortcut to set features 47 pub fn insert_key_value(&mut self, key: SmolStr, value: SmolStr) {
50 pub fn features(mut self, iter: impl IntoIterator<Item = SmolStr>) -> CfgOptions { 48 self.key_values.insert((key, value));
51 for feat in iter {
52 self = self.key_value("feature".into(), feat);
53 }
54 self
55 } 49 }
56 50
57 pub fn remove_atom(mut self, name: &SmolStr) -> CfgOptions { 51 /// Shortcut to set features
58 self.atoms.remove(name); 52 pub fn insert_features(&mut self, iter: impl IntoIterator<Item = SmolStr>) {
59 self 53 iter.into_iter().for_each(|feat| self.insert_key_value("feature".into(), feat));
60 } 54 }
61} 55}