aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cfg
diff options
context:
space:
mode:
authorrobojumper <[email protected]>2020-05-04 12:29:09 +0100
committerrobojumper <[email protected]>2020-05-04 12:29:09 +0100
commit2980ba1fde50a6fc8863750b9dd7f09e3c1227ce (patch)
tree6b90bc58f5f7dc661d71d3a4a499ae028a9f43ed /crates/ra_cfg
parent6a48a94d47bfd6a340cbdb3f68b5bce4167c8168 (diff)
Support build.rs cargo:rustc-cfg
Diffstat (limited to 'crates/ra_cfg')
-rw-r--r--crates/ra_cfg/src/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_cfg/src/lib.rs b/crates/ra_cfg/src/lib.rs
index 51d953f6e..697a04581 100644
--- a/crates/ra_cfg/src/lib.rs
+++ b/crates/ra_cfg/src/lib.rs
@@ -53,4 +53,13 @@ impl CfgOptions {
53 pub fn insert_features(&mut self, iter: impl IntoIterator<Item = SmolStr>) { 53 pub fn insert_features(&mut self, iter: impl IntoIterator<Item = SmolStr>) {
54 iter.into_iter().for_each(|feat| self.insert_key_value("feature".into(), feat)); 54 iter.into_iter().for_each(|feat| self.insert_key_value("feature".into(), feat));
55 } 55 }
56
57 /// Shortcut to set cfgs
58 pub fn insert_cfgs(&mut self, iter: impl IntoIterator<Item = SmolStr>) {
59 iter.into_iter().for_each(|cfg| match cfg.find('=') {
60 Some(split) => self
61 .insert_key_value(cfg[0..split].into(), cfg[split + 1..].trim_matches('"').into()),
62 None => self.insert_atom(cfg),
63 });
64 }
56} 65}