@@ -238,7 +238,7 @@ macro_rules! configure {
238238}
239239
240240impl < ' 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 > {
242242 self . process_cfg_attrs ( & mut node) ;
243243 if self . in_cfg ( node. attrs ( ) ) {
244244 self . try_configure_tokens ( & mut node) ;
@@ -248,7 +248,7 @@ impl<'a> StripUnconfigured<'a> {
248248 }
249249 }
250250
251- fn try_configure_tokens < T : AstLike > ( & mut self , node : & mut T ) {
251+ fn try_configure_tokens < T : AstLike > ( & self , node : & mut T ) {
252252 if self . config_tokens {
253253 if let Some ( Some ( tokens) ) = node. tokens_mut ( ) {
254254 let attr_annotated_tokens = tokens. create_token_stream ( ) ;
@@ -257,10 +257,7 @@ impl<'a> StripUnconfigured<'a> {
257257 }
258258 }
259259
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 > > {
264261 attrs. flat_map_in_place ( |attr| self . process_cfg_attr ( attr) ) ;
265262 if self . in_cfg ( & attrs) { Some ( attrs) } else { None }
266263 }
@@ -269,7 +266,7 @@ impl<'a> StripUnconfigured<'a> {
269266 /// This is only used during the invocation of `derive` proc-macros,
270267 /// which require that we cfg-expand their entire input.
271268 /// 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 {
273270 fn can_skip ( stream : & AttrAnnotatedTokenStream ) -> bool {
274271 stream. 0 . iter ( ) . all ( |( tree, _spacing) | match tree {
275272 AttrAnnotatedTokenTree :: Attributes ( _) => false ,
@@ -325,7 +322,7 @@ impl<'a> StripUnconfigured<'a> {
325322 /// Gives compiler warnings if any `cfg_attr` does not contain any
326323 /// attributes and is in the original source code. Gives compiler errors if
327324 /// 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 ) {
329326 node. visit_attrs ( |attrs| {
330327 attrs. flat_map_in_place ( |attr| self . process_cfg_attr ( attr) ) ;
331328 } ) ;
@@ -338,7 +335,7 @@ impl<'a> StripUnconfigured<'a> {
338335 /// Gives a compiler warning when the `cfg_attr` contains no attributes and
339336 /// is in the original source file. Gives a compiler error if the syntax of
340337 /// 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 > {
342339 if !attr. has_name ( sym:: cfg_attr) {
343340 return vec ! [ attr] ;
344341 }
@@ -461,7 +458,7 @@ impl<'a> StripUnconfigured<'a> {
461458 }
462459 }
463460
464- pub fn configure_expr ( & mut self , expr : & mut P < ast:: Expr > ) {
461+ pub fn configure_expr ( & self , expr : & mut P < ast:: Expr > ) {
465462 for attr in expr. attrs . iter ( ) {
466463 self . maybe_emit_expr_attr_err ( attr) ;
467464 }
0 commit comments