File tree 2 files changed +12
-18
lines changed 2 files changed +12
-18
lines changed Original file line number Diff line number Diff line change 2
2
3
3
mod cfg_expr;
4
4
5
- use std:: iter:: IntoIterator ;
6
-
7
5
use ra_syntax:: SmolStr ;
8
6
use rustc_hash:: FxHashSet ;
9
7
@@ -48,18 +46,4 @@ impl CfgOptions {
48
46
pub fn insert_key_value ( & mut self , key : SmolStr , value : SmolStr ) {
49
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
}
Original file line number Diff line number Diff line change @@ -398,8 +398,18 @@ impl ProjectWorkspace {
398
398
let edition = cargo[ pkg] . edition ;
399
399
let cfg_options = {
400
400
let mut opts = default_cfg_options. clone ( ) ;
401
- opts. insert_features ( cargo[ pkg] . features . iter ( ) . map ( Into :: into) ) ;
402
- opts. insert_cfgs ( cargo[ pkg] . cfgs . iter ( ) . map ( Into :: into) ) ;
401
+ for feature in cargo[ pkg] . features . iter ( ) {
402
+ opts. insert_key_value ( "feature" . into ( ) , feature. into ( ) ) ;
403
+ }
404
+ for cfg in cargo[ pkg] . cfgs . iter ( ) {
405
+ match cfg. find ( '=' ) {
406
+ Some ( split) => opts. insert_key_value (
407
+ cfg[ ..split] . into ( ) ,
408
+ cfg[ split + 1 ..] . trim_matches ( '"' ) . into ( ) ,
409
+ ) ,
410
+ None => opts. insert_atom ( cfg. into ( ) ) ,
411
+ } ;
412
+ }
403
413
opts
404
414
} ;
405
415
let mut env = Env :: default ( ) ;
You can’t perform that action at this time.
0 commit comments