@@ -657,15 +657,15 @@ impl NestedMetaItem {
657657}
658658
659659pub trait HasAttrs : Sized {
660- fn attrs ( & self ) -> & [ ast :: Attribute ] ;
661- fn visit_attrs < F : FnOnce ( & mut Vec < ast :: Attribute > ) > ( & mut self , f : F ) ;
660+ fn attrs ( & self ) -> & [ Attribute ] ;
661+ fn visit_attrs ( & mut self , f : impl FnOnce ( & mut Vec < Attribute > ) ) ;
662662}
663663
664664impl < T : HasAttrs > HasAttrs for Spanned < T > {
665- fn attrs ( & self ) -> & [ ast :: Attribute ] {
665+ fn attrs ( & self ) -> & [ Attribute ] {
666666 self . node . attrs ( )
667667 }
668- fn visit_attrs < F : FnOnce ( & mut Vec < ast :: Attribute > ) > ( & mut self , f : F ) {
668+ fn visit_attrs ( & mut self , f : impl FnOnce ( & mut Vec < Attribute > ) ) {
669669 self . node . visit_attrs ( f) ;
670670 }
671671}
@@ -674,7 +674,7 @@ impl HasAttrs for Vec<Attribute> {
674674 fn attrs ( & self ) -> & [ Attribute ] {
675675 self
676676 }
677- fn visit_attrs < F : FnOnce ( & mut Vec < Attribute > ) > ( & mut self , f : F ) {
677+ fn visit_attrs ( & mut self , f : impl FnOnce ( & mut Vec < Attribute > ) ) {
678678 f ( self )
679679 }
680680}
@@ -683,7 +683,7 @@ impl HasAttrs for AttrVec {
683683 fn attrs ( & self ) -> & [ Attribute ] {
684684 self
685685 }
686- fn visit_attrs < F : FnOnce ( & mut Vec < Attribute > ) > ( & mut self , f : F ) {
686+ fn visit_attrs ( & mut self , f : impl FnOnce ( & mut Vec < Attribute > ) ) {
687687 visit_clobber ( self , |this| {
688688 let mut vec = this. into ( ) ;
689689 f ( & mut vec) ;
@@ -696,7 +696,7 @@ impl<T: HasAttrs + 'static> HasAttrs for P<T> {
696696 fn attrs ( & self ) -> & [ Attribute ] {
697697 ( * * self ) . attrs ( )
698698 }
699- fn visit_attrs < F : FnOnce ( & mut Vec < Attribute > ) > ( & mut self , f : F ) {
699+ fn visit_attrs ( & mut self , f : impl FnOnce ( & mut Vec < Attribute > ) ) {
700700 ( * * self ) . visit_attrs ( f) ;
701701 }
702702}
@@ -714,7 +714,7 @@ impl HasAttrs for StmtKind {
714714 }
715715 }
716716
717- fn visit_attrs < F : FnOnce ( & mut Vec < Attribute > ) > ( & mut self , f : F ) {
717+ fn visit_attrs ( & mut self , f : impl FnOnce ( & mut Vec < Attribute > ) ) {
718718 match self {
719719 StmtKind :: Local ( local) => local. visit_attrs ( f) ,
720720 StmtKind :: Item ( ..) => { }
@@ -733,29 +733,19 @@ impl HasAttrs for Stmt {
733733 self . kind . attrs ( )
734734 }
735735
736- fn visit_attrs < F : FnOnce ( & mut Vec < ast :: Attribute > ) > ( & mut self , f : F ) {
736+ fn visit_attrs ( & mut self , f : impl FnOnce ( & mut Vec < Attribute > ) ) {
737737 self . kind . visit_attrs ( f) ;
738738 }
739739}
740740
741- impl HasAttrs for GenericParam {
742- fn attrs ( & self ) -> & [ ast:: Attribute ] {
743- & self . attrs
744- }
745-
746- fn visit_attrs < F : FnOnce ( & mut Vec < Attribute > ) > ( & mut self , f : F ) {
747- self . attrs . visit_attrs ( f) ;
748- }
749- }
750-
751741macro_rules! derive_has_attrs {
752742 ( $( $ty: path) ,* ) => { $(
753743 impl HasAttrs for $ty {
754744 fn attrs( & self ) -> & [ Attribute ] {
755745 & self . attrs
756746 }
757747
758- fn visit_attrs< F : FnOnce ( & mut Vec <Attribute >) > ( & mut self , f : F ) {
748+ fn visit_attrs( & mut self , f : impl FnOnce ( & mut Vec <Attribute >) ) {
759749 self . attrs. visit_attrs( f) ;
760750 }
761751 }
@@ -764,5 +754,5 @@ macro_rules! derive_has_attrs {
764754
765755derive_has_attrs ! {
766756 Item , Expr , Local , ast:: ForeignItem , ast:: StructField , ast:: AssocItem , ast:: Arm ,
767- ast:: Field , ast:: FieldPat , ast:: Variant , ast:: Param
757+ ast:: Field , ast:: FieldPat , ast:: Variant , ast:: Param , GenericParam
768758}
0 commit comments