From db99f2dd7e8e244b858926bbf1d2a49e25f44733 Mon Sep 17 00:00:00 2001 From: Paul Daniel Faria Date: Fri, 12 Jun 2020 13:08:51 -0400 Subject: Add optional target to crates in json project, lookup default cfgs per target when generating cfg list --- crates/ra_cfg/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'crates/ra_cfg/src/lib.rs') diff --git a/crates/ra_cfg/src/lib.rs b/crates/ra_cfg/src/lib.rs index 57feabcb2..f9c73ece1 100644 --- a/crates/ra_cfg/src/lib.rs +++ b/crates/ra_cfg/src/lib.rs @@ -46,4 +46,14 @@ impl CfgOptions { pub fn insert_key_value(&mut self, key: SmolStr, value: SmolStr) { self.key_values.insert((key, value)); } + + pub fn append(&mut self, other: &CfgOptions) { + for atom in &other.atoms { + self.atoms.insert(atom.clone()); + } + + for (key, value) in &other.key_values { + self.key_values.insert((key.clone(), value.clone())); + } + } } -- cgit v1.2.3 From 0cf8ee2dc22569fac2115c41b85d5df23af3ce5a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 23 Jul 2020 15:57:25 +0200 Subject: Remove dead code --- crates/ra_cfg/src/lib.rs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'crates/ra_cfg/src/lib.rs') diff --git a/crates/ra_cfg/src/lib.rs b/crates/ra_cfg/src/lib.rs index f9c73ece1..cd097f2a0 100644 --- a/crates/ra_cfg/src/lib.rs +++ b/crates/ra_cfg/src/lib.rs @@ -39,10 +39,6 @@ impl CfgOptions { self.atoms.insert(key); } - pub fn remove_atom(&mut self, name: &str) { - self.atoms.remove(name); - } - pub fn insert_key_value(&mut self, key: SmolStr, value: SmolStr) { self.key_values.insert((key, value)); } -- cgit v1.2.3 From 38e38d9b290ff90973c25a06962b81dbbb5d3d9e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 23 Jul 2020 16:22:17 +0200 Subject: Cleanup CFG API --- crates/ra_cfg/src/lib.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'crates/ra_cfg/src/lib.rs') diff --git a/crates/ra_cfg/src/lib.rs b/crates/ra_cfg/src/lib.rs index cd097f2a0..cd5a0a7b6 100644 --- a/crates/ra_cfg/src/lib.rs +++ b/crates/ra_cfg/src/lib.rs @@ -5,7 +5,7 @@ mod cfg_expr; use ra_syntax::SmolStr; use rustc_hash::FxHashSet; -pub use cfg_expr::{parse_cfg, CfgExpr}; +pub use cfg_expr::CfgExpr; /// Configuration options used for conditional compilition on items with `cfg` attributes. /// We have two kind of options in different namespaces: atomic options like `unix`, and @@ -31,10 +31,6 @@ impl CfgOptions { }) } - pub fn is_cfg_enabled(&self, attr: &tt::Subtree) -> Option { - self.check(&parse_cfg(attr)) - } - pub fn insert_atom(&mut self, key: SmolStr) { self.atoms.insert(key); } -- cgit v1.2.3