@@ -38,16 +38,14 @@ pub(crate) fn cfg_eval(
38
38
lint_node_id : NodeId ,
39
39
) -> Annotatable {
40
40
let features = Some ( features) ;
41
- CfgEval { cfg : & mut StripUnconfigured { sess, features, config_tokens : true , lint_node_id } }
41
+ CfgEval ( StripUnconfigured { sess, features, config_tokens : true , lint_node_id } )
42
42
. configure_annotatable ( annotatable)
43
43
// Since the item itself has already been configured by the `InvocationCollector`,
44
44
// we know that fold result vector will contain exactly one element.
45
45
. unwrap ( )
46
46
}
47
47
48
- struct CfgEval < ' a , ' b > {
49
- cfg : & ' a mut StripUnconfigured < ' b > ,
50
- }
48
+ struct CfgEval < ' a > ( StripUnconfigured < ' a > ) ;
51
49
52
50
fn flat_map_annotatable (
53
51
vis : & mut impl MutVisitor ,
@@ -125,9 +123,9 @@ fn has_cfg_or_cfg_attr(annotatable: &Annotatable) -> bool {
125
123
res. is_break ( )
126
124
}
127
125
128
- impl CfgEval < ' _ , ' _ > {
126
+ impl CfgEval < ' _ > {
129
127
fn configure < T : HasAttrs + HasTokens > ( & mut self , node : T ) -> Option < T > {
130
- self . cfg . configure ( node)
128
+ self . 0 . configure ( node)
131
129
}
132
130
133
131
fn configure_annotatable ( & mut self , mut annotatable : Annotatable ) -> Option < Annotatable > {
@@ -196,7 +194,7 @@ impl CfgEval<'_, '_> {
196
194
// Re-parse the tokens, setting the `capture_cfg` flag to save extra information
197
195
// to the captured `AttrTokenStream` (specifically, we capture
198
196
// `AttrTokenTree::AttributesData` for all occurrences of `#[cfg]` and `#[cfg_attr]`)
199
- let mut parser = Parser :: new ( & self . cfg . sess . psess , orig_tokens, None ) ;
197
+ let mut parser = Parser :: new ( & self . 0 . sess . psess , orig_tokens, None ) ;
200
198
parser. capture_cfg = true ;
201
199
match parse_annotatable_with ( & mut parser) {
202
200
Ok ( a) => annotatable = a,
@@ -212,16 +210,16 @@ impl CfgEval<'_, '_> {
212
210
}
213
211
}
214
212
215
- impl MutVisitor for CfgEval < ' _ , ' _ > {
213
+ impl MutVisitor for CfgEval < ' _ > {
216
214
#[ instrument( level = "trace" , skip( self ) ) ]
217
215
fn visit_expr ( & mut self , expr : & mut P < ast:: Expr > ) {
218
- self . cfg . configure_expr ( expr, false ) ;
216
+ self . 0 . configure_expr ( expr, false ) ;
219
217
mut_visit:: noop_visit_expr ( expr, self ) ;
220
218
}
221
219
222
220
#[ instrument( level = "trace" , skip( self ) ) ]
223
221
fn visit_method_receiver_expr ( & mut self , expr : & mut P < ast:: Expr > ) {
224
- self . cfg . configure_expr ( expr, true ) ;
222
+ self . 0 . configure_expr ( expr, true ) ;
225
223
mut_visit:: noop_visit_expr ( expr, self ) ;
226
224
}
227
225
0 commit comments