@@ -209,7 +209,7 @@ pub trait Folder : Sized {
209
209
noop_fold_label ( label, self )
210
210
}
211
211
212
- fn fold_attribute ( & mut self , at : Attribute ) -> Option < Attribute > {
212
+ fn fold_attribute ( & mut self , at : Attribute ) -> Attribute {
213
213
noop_fold_attribute ( at, self )
214
214
}
215
215
@@ -313,7 +313,7 @@ pub fn noop_fold_use_tree<T: Folder>(use_tree: UseTree, fld: &mut T) -> UseTree
313
313
}
314
314
315
315
pub fn fold_attrs < T : Folder > ( attrs : Vec < Attribute > , fld : & mut T ) -> Vec < Attribute > {
316
- attrs. move_flat_map ( |x| fld. fold_attribute ( x) )
316
+ attrs. move_map ( |x| fld. fold_attribute ( x) )
317
317
}
318
318
319
319
pub fn fold_thin_attrs < T : Folder > ( attrs : ThinVec < Attribute > , fld : & mut T ) -> ThinVec < Attribute > {
@@ -485,15 +485,15 @@ pub fn noop_fold_local<T: Folder>(l: P<Local>, fld: &mut T) -> P<Local> {
485
485
} )
486
486
}
487
487
488
- pub fn noop_fold_attribute < T : Folder > ( attr : Attribute , fld : & mut T ) -> Option < Attribute > {
489
- Some ( Attribute {
488
+ pub fn noop_fold_attribute < T : Folder > ( attr : Attribute , fld : & mut T ) -> Attribute {
489
+ Attribute {
490
490
id : attr. id ,
491
491
style : attr. style ,
492
492
path : fld. fold_path ( attr. path ) ,
493
493
tokens : fld. fold_tts ( attr. tokens ) ,
494
494
is_sugared_doc : attr. is_sugared_doc ,
495
495
span : fld. new_span ( attr. span ) ,
496
- } )
496
+ }
497
497
}
498
498
499
499
pub fn noop_fold_mac < T : Folder > ( Spanned { node, span} : Mac , fld : & mut T ) -> Mac {
@@ -678,14 +678,10 @@ pub fn noop_fold_param_bound<T>(pb: GenericBound, fld: &mut T) -> GenericBound w
678
678
}
679
679
680
680
pub fn noop_fold_generic_param < T : Folder > ( param : GenericParam , fld : & mut T ) -> GenericParam {
681
- let attrs: Vec < _ > = param. attrs . into ( ) ;
682
681
GenericParam {
683
682
ident : fld. fold_ident ( param. ident ) ,
684
683
id : fld. new_id ( param. id ) ,
685
- attrs : attrs. into_iter ( )
686
- . flat_map ( |x| fld. fold_attribute ( x) . into_iter ( ) )
687
- . collect :: < Vec < _ > > ( )
688
- . into ( ) ,
684
+ attrs : fold_thin_attrs ( param. attrs , fld) ,
689
685
bounds : param. bounds . move_map ( |l| noop_fold_param_bound ( l, fld) ) ,
690
686
kind : match param. kind {
691
687
GenericParamKind :: Lifetime => GenericParamKind :: Lifetime ,
0 commit comments