@@ -59,9 +59,11 @@ impl<'tcx, T: LateLintPass<'tcx>> LateContextAndPass<'tcx, T> {
5959 let attrs = self . context . tcx . hir ( ) . attrs ( id) ;
6060 let prev = self . context . last_node_with_lint_attrs ;
6161 self . context . last_node_with_lint_attrs = id;
62- self . enter_attrs ( attrs) ;
62+ debug ! ( "late context: enter_attrs({:?})" , attrs) ;
63+ lint_callback ! ( self , enter_lint_attrs, attrs) ;
6364 f ( self ) ;
64- self . exit_attrs ( attrs) ;
65+ debug ! ( "late context: exit_attrs({:?})" , attrs) ;
66+ lint_callback ! ( self , exit_lint_attrs, attrs) ;
6567 self . context . last_node_with_lint_attrs = prev;
6668 }
6769
@@ -81,16 +83,6 @@ impl<'tcx, T: LateLintPass<'tcx>> LateContextAndPass<'tcx, T> {
8183 hir_visit:: walk_mod ( self , m, n) ;
8284 lint_callback ! ( self , check_mod_post, m, s, n) ;
8385 }
84-
85- fn enter_attrs ( & mut self , attrs : & ' tcx [ ast:: Attribute ] ) {
86- debug ! ( "late context: enter_attrs({:?})" , attrs) ;
87- lint_callback ! ( self , enter_lint_attrs, attrs) ;
88- }
89-
90- fn exit_attrs ( & mut self , attrs : & ' tcx [ ast:: Attribute ] ) {
91- debug ! ( "late context: exit_attrs({:?})" , attrs) ;
92- lint_callback ! ( self , exit_lint_attrs, attrs) ;
93- }
9486}
9587
9688impl < ' tcx , T : LateLintPass < ' tcx > > hir_visit:: Visitor < ' tcx > for LateContextAndPass < ' tcx , T > {
@@ -337,10 +329,8 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
337329 hir_visit:: walk_path ( self , p) ;
338330 }
339331
340- fn visit_attribute ( & mut self , hir_id : hir:: HirId , attr : & ' tcx ast:: Attribute ) {
341- self . with_lint_attrs ( hir_id, |cx| {
342- lint_callback ! ( cx, check_attribute, attr) ;
343- } )
332+ fn visit_attribute ( & mut self , attr : & ' tcx ast:: Attribute ) {
333+ lint_callback ! ( self , check_attribute, attr) ;
344334 }
345335}
346336
@@ -402,7 +392,7 @@ fn late_lint_mod_pass<'tcx, T: LateLintPass<'tcx>>(
402392 // Visit the crate attributes
403393 if hir_id == hir:: CRATE_HIR_ID {
404394 for attr in tcx. hir ( ) . attrs ( hir:: CRATE_HIR_ID ) . iter ( ) {
405- cx. visit_attribute ( hir_id , attr)
395+ cx. visit_attribute ( attr)
406396 }
407397 }
408398}
0 commit comments