diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-05-08 01:57:29 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-08 01:57:29 +0100 |
commit | 6f2f9049dad24681a5e785555f975bfed8138d45 (patch) | |
tree | 6d009aa2fd585161338cb7b7587e0c35fa0aa1a7 /crates/ra_cfg | |
parent | 7be0a29c63e23ce55a21084b845cb3266e0246a3 (diff) | |
parent | d3110859ba4e97cf17d2c997befa92fb63bfb138 (diff) |
Merge #4370
4370: Move feature desugaring to the right abstraction layer r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_cfg')
-rw-r--r-- | crates/ra_cfg/src/lib.rs | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/crates/ra_cfg/src/lib.rs b/crates/ra_cfg/src/lib.rs index 697a04581..57feabcb2 100644 --- a/crates/ra_cfg/src/lib.rs +++ b/crates/ra_cfg/src/lib.rs | |||
@@ -2,8 +2,6 @@ | |||
2 | 2 | ||
3 | mod cfg_expr; | 3 | mod cfg_expr; |
4 | 4 | ||
5 | use std::iter::IntoIterator; | ||
6 | |||
7 | use ra_syntax::SmolStr; | 5 | use ra_syntax::SmolStr; |
8 | use rustc_hash::FxHashSet; | 6 | use rustc_hash::FxHashSet; |
9 | 7 | ||
@@ -48,18 +46,4 @@ impl CfgOptions { | |||
48 | pub fn insert_key_value(&mut self, key: SmolStr, value: SmolStr) { | 46 | pub fn insert_key_value(&mut self, key: SmolStr, value: SmolStr) { |
49 | self.key_values.insert((key, value)); | 47 | self.key_values.insert((key, value)); |
50 | } | 48 | } |
51 | |||
52 | /// Shortcut to set features | ||
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)); | ||
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 | } | ||
65 | } | 49 | } |