@@ -137,7 +137,6 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
137
137
} ;
138
138
hir_collector. visit_testable (
139
139
"" . to_string ( ) ,
140
- & krate. item . attrs ,
141
140
CRATE_HIR_ID ,
142
141
krate. item . span ,
143
142
|this| {
@@ -991,11 +990,11 @@ impl<'a, 'hir, 'tcx> HirCollector<'a, 'hir, 'tcx> {
991
990
fn visit_testable < F : FnOnce ( & mut Self ) > (
992
991
& mut self ,
993
992
name : String ,
994
- attrs : & [ ast:: Attribute ] ,
995
993
hir_id : HirId ,
996
994
sp : Span ,
997
995
nested : F ,
998
996
) {
997
+ let attrs = self . tcx . hir ( ) . attrs ( hir_id) ;
999
998
let mut attrs = Attributes :: from_ast ( self . sess . diagnostic ( ) , attrs, None ) ;
1000
999
if let Some ( ref cfg) = attrs. cfg {
1001
1000
if !cfg. matches ( & self . sess . parse_sess , Some ( & self . sess . features_untracked ( ) ) ) {
@@ -1053,45 +1052,27 @@ impl<'a, 'hir, 'tcx> intravisit::Visitor<'hir> for HirCollector<'a, 'hir, 'tcx>
1053
1052
item. ident . to_string ( )
1054
1053
} ;
1055
1054
1056
- self . visit_testable ( name, & item . attrs , item. hir_id ( ) , item. span , |this| {
1055
+ self . visit_testable ( name, item. hir_id ( ) , item. span , |this| {
1057
1056
intravisit:: walk_item ( this, item) ;
1058
1057
} ) ;
1059
1058
}
1060
1059
1061
1060
fn visit_trait_item ( & mut self , item : & ' hir hir:: TraitItem < ' _ > ) {
1062
- self . visit_testable (
1063
- item. ident . to_string ( ) ,
1064
- & item. attrs ,
1065
- item. hir_id ( ) ,
1066
- item. span ,
1067
- |this| {
1068
- intravisit:: walk_trait_item ( this, item) ;
1069
- } ,
1070
- ) ;
1061
+ self . visit_testable ( item. ident . to_string ( ) , item. hir_id ( ) , item. span , |this| {
1062
+ intravisit:: walk_trait_item ( this, item) ;
1063
+ } ) ;
1071
1064
}
1072
1065
1073
1066
fn visit_impl_item ( & mut self , item : & ' hir hir:: ImplItem < ' _ > ) {
1074
- self . visit_testable (
1075
- item. ident . to_string ( ) ,
1076
- & item. attrs ,
1077
- item. hir_id ( ) ,
1078
- item. span ,
1079
- |this| {
1080
- intravisit:: walk_impl_item ( this, item) ;
1081
- } ,
1082
- ) ;
1067
+ self . visit_testable ( item. ident . to_string ( ) , item. hir_id ( ) , item. span , |this| {
1068
+ intravisit:: walk_impl_item ( this, item) ;
1069
+ } ) ;
1083
1070
}
1084
1071
1085
1072
fn visit_foreign_item ( & mut self , item : & ' hir hir:: ForeignItem < ' _ > ) {
1086
- self . visit_testable (
1087
- item. ident . to_string ( ) ,
1088
- & item. attrs ,
1089
- item. hir_id ( ) ,
1090
- item. span ,
1091
- |this| {
1092
- intravisit:: walk_foreign_item ( this, item) ;
1093
- } ,
1094
- ) ;
1073
+ self . visit_testable ( item. ident . to_string ( ) , item. hir_id ( ) , item. span , |this| {
1074
+ intravisit:: walk_foreign_item ( this, item) ;
1075
+ } ) ;
1095
1076
}
1096
1077
1097
1078
fn visit_variant (
@@ -1100,21 +1081,20 @@ impl<'a, 'hir, 'tcx> intravisit::Visitor<'hir> for HirCollector<'a, 'hir, 'tcx>
1100
1081
g : & ' hir hir:: Generics < ' _ > ,
1101
1082
item_id : hir:: HirId ,
1102
1083
) {
1103
- self . visit_testable ( v. ident . to_string ( ) , & v . attrs , v. id , v. span , |this| {
1084
+ self . visit_testable ( v. ident . to_string ( ) , v. id , v. span , |this| {
1104
1085
intravisit:: walk_variant ( this, v, g, item_id) ;
1105
1086
} ) ;
1106
1087
}
1107
1088
1108
1089
fn visit_struct_field ( & mut self , f : & ' hir hir:: StructField < ' _ > ) {
1109
- self . visit_testable ( f. ident . to_string ( ) , & f . attrs , f. hir_id , f. span , |this| {
1090
+ self . visit_testable ( f. ident . to_string ( ) , f. hir_id , f. span , |this| {
1110
1091
intravisit:: walk_struct_field ( this, f) ;
1111
1092
} ) ;
1112
1093
}
1113
1094
1114
1095
fn visit_macro_def ( & mut self , macro_def : & ' hir hir:: MacroDef < ' _ > ) {
1115
1096
self . visit_testable (
1116
1097
macro_def. ident . to_string ( ) ,
1117
- & macro_def. attrs ,
1118
1098
macro_def. hir_id ( ) ,
1119
1099
macro_def. span ,
1120
1100
|_| ( ) ,
0 commit comments