aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cfg
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-10-08 12:55:27 +0100
committerGitHub <[email protected]>2019-10-08 12:55:27 +0100
commit06a8deae4a29949f438d66c54eed4e016ac35432 (patch)
tree695c569cd28f84ca2dd1b75a8d4b3e71f1dabe09 /crates/ra_cfg
parent92cf0eba93b8d2705ed39bef1a4ea665ed3c25dc (diff)
parent6503add6e3c900ea7ded37199ea58f43bb57b051 (diff)
Merge #1969
1969: restore coloring of attributes r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
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}