@@ -238,7 +238,7 @@ macro_rules! configure {
238
238
}
239
239
240
240
impl < ' a > StripUnconfigured < ' a > {
241
- pub fn configure < T : AstLike > ( & mut self , mut node : T ) -> Option < T > {
241
+ pub fn configure < T : AstLike > ( & self , mut node : T ) -> Option < T > {
242
242
self . process_cfg_attrs ( & mut node) ;
243
243
if self . in_cfg ( node. attrs ( ) ) {
244
244
self . try_configure_tokens ( & mut node) ;
@@ -248,7 +248,7 @@ impl<'a> StripUnconfigured<'a> {
248
248
}
249
249
}
250
250
251
- fn try_configure_tokens < T : AstLike > ( & mut self , node : & mut T ) {
251
+ fn try_configure_tokens < T : AstLike > ( & self , node : & mut T ) {
252
252
if self . config_tokens {
253
253
if let Some ( Some ( tokens) ) = node. tokens_mut ( ) {
254
254
let attr_annotated_tokens = tokens. create_token_stream ( ) ;
@@ -257,10 +257,7 @@ impl<'a> StripUnconfigured<'a> {
257
257
}
258
258
}
259
259
260
- fn configure_krate_attrs (
261
- & mut self ,
262
- mut attrs : Vec < ast:: Attribute > ,
263
- ) -> Option < Vec < ast:: Attribute > > {
260
+ fn configure_krate_attrs ( & self , mut attrs : Vec < ast:: Attribute > ) -> Option < Vec < ast:: Attribute > > {
264
261
attrs. flat_map_in_place ( |attr| self . process_cfg_attr ( attr) ) ;
265
262
if self . in_cfg ( & attrs) { Some ( attrs) } else { None }
266
263
}
@@ -269,7 +266,7 @@ impl<'a> StripUnconfigured<'a> {
269
266
/// This is only used during the invocation of `derive` proc-macros,
270
267
/// which require that we cfg-expand their entire input.
271
268
/// Normal cfg-expansion operates on parsed AST nodes via the `configure` method
272
- fn configure_tokens ( & mut self , stream : & AttrAnnotatedTokenStream ) -> AttrAnnotatedTokenStream {
269
+ fn configure_tokens ( & self , stream : & AttrAnnotatedTokenStream ) -> AttrAnnotatedTokenStream {
273
270
fn can_skip ( stream : & AttrAnnotatedTokenStream ) -> bool {
274
271
stream. 0 . iter ( ) . all ( |( tree, _spacing) | match tree {
275
272
AttrAnnotatedTokenTree :: Attributes ( _) => false ,
@@ -325,7 +322,7 @@ impl<'a> StripUnconfigured<'a> {
325
322
/// Gives compiler warnings if any `cfg_attr` does not contain any
326
323
/// attributes and is in the original source code. Gives compiler errors if
327
324
/// the syntax of any `cfg_attr` is incorrect.
328
- fn process_cfg_attrs < T : AstLike > ( & mut self , node : & mut T ) {
325
+ fn process_cfg_attrs < T : AstLike > ( & self , node : & mut T ) {
329
326
node. visit_attrs ( |attrs| {
330
327
attrs. flat_map_in_place ( |attr| self . process_cfg_attr ( attr) ) ;
331
328
} ) ;
@@ -338,7 +335,7 @@ impl<'a> StripUnconfigured<'a> {
338
335
/// Gives a compiler warning when the `cfg_attr` contains no attributes and
339
336
/// is in the original source file. Gives a compiler error if the syntax of
340
337
/// the attribute is incorrect.
341
- fn process_cfg_attr ( & mut self , attr : Attribute ) -> Vec < Attribute > {
338
+ fn process_cfg_attr ( & self , attr : Attribute ) -> Vec < Attribute > {
342
339
if !attr. has_name ( sym:: cfg_attr) {
343
340
return vec ! [ attr] ;
344
341
}
@@ -461,7 +458,7 @@ impl<'a> StripUnconfigured<'a> {
461
458
}
462
459
}
463
460
464
- pub fn configure_expr ( & mut self , expr : & mut P < ast:: Expr > ) {
461
+ pub fn configure_expr ( & self , expr : & mut P < ast:: Expr > ) {
465
462
for attr in expr. attrs . iter ( ) {
466
463
self . maybe_emit_expr_attr_err ( attr) ;
467
464
}
0 commit comments