@@ -209,7 +209,7 @@ pub trait Folder : Sized {
209209 noop_fold_label ( label, self )
210210 }
211211
212- fn fold_attribute ( & mut self , at : Attribute ) -> Option < Attribute > {
212+ fn fold_attribute ( & mut self , at : Attribute ) -> Attribute {
213213 noop_fold_attribute ( at, self )
214214 }
215215
@@ -313,7 +313,7 @@ pub fn noop_fold_use_tree<T: Folder>(use_tree: UseTree, fld: &mut T) -> UseTree
313313}
314314
315315pub 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) )
317317}
318318
319319pub 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> {
485485 } )
486486}
487487
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 {
490490 id : attr. id ,
491491 style : attr. style ,
492492 path : fld. fold_path ( attr. path ) ,
493493 tokens : fld. fold_tts ( attr. tokens ) ,
494494 is_sugared_doc : attr. is_sugared_doc ,
495495 span : fld. new_span ( attr. span ) ,
496- } )
496+ }
497497}
498498
499499pub 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
678678}
679679
680680pub fn noop_fold_generic_param < T : Folder > ( param : GenericParam , fld : & mut T ) -> GenericParam {
681- let attrs: Vec < _ > = param. attrs . into ( ) ;
682681 GenericParam {
683682 ident : fld. fold_ident ( param. ident ) ,
684683 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) ,
689685 bounds : param. bounds . move_map ( |l| noop_fold_param_bound ( l, fld) ) ,
690686 kind : match param. kind {
691687 GenericParamKind :: Lifetime => GenericParamKind :: Lifetime ,
0 commit comments