aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cfg
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-05-07 19:50:00 +0100
committerGitHub <[email protected]>2020-05-07 19:50:00 +0100
commit1b136aae0b92b4b75ae1aad28ccf27d8b2b6cf73 (patch)
treee76f5011154b29d1987e098e06ae6e1d05b8f650 /crates/ra_cfg
parent97b9b364d65b00ce2246da7670a3823a0bccc1d3 (diff)
parentf2dd233ddc60b647fe9c32ea2d712224005ae99e (diff)
Merge #4296
4296: Support cargo:rustc-cfg in build.rs r=matklad a=robojumper Fixes #4238. Co-authored-by: robojumper <[email protected]>
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}