diff options
Diffstat (limited to 'crates/ra_cfg')
-rw-r--r-- | crates/ra_cfg/src/lib.rs | 9 |
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 | } |