From 2980ba1fde50a6fc8863750b9dd7f09e3c1227ce Mon Sep 17 00:00:00 2001
From: robojumper <robojumper@gmail.com>
Date: Mon, 4 May 2020 13:29:09 +0200
Subject: Support build.rs cargo:rustc-cfg

---
 crates/ra_cfg/src/lib.rs | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'crates/ra_cfg/src')

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 {
     pub fn insert_features(&mut self, iter: impl IntoIterator<Item = SmolStr>) {
         iter.into_iter().for_each(|feat| self.insert_key_value("feature".into(), feat));
     }
+
+    /// Shortcut to set cfgs
+    pub fn insert_cfgs(&mut self, iter: impl IntoIterator<Item = SmolStr>) {
+        iter.into_iter().for_each(|cfg| match cfg.find('=') {
+            Some(split) => self
+                .insert_key_value(cfg[0..split].into(), cfg[split + 1..].trim_matches('"').into()),
+            None => self.insert_atom(cfg),
+        });
+    }
 }
-- 
cgit v1.2.3