@@ -59,9 +59,11 @@ impl<'tcx, T: LateLintPass<'tcx>> LateContextAndPass<'tcx, T> {
59
59
let attrs = self . context . tcx . hir ( ) . attrs ( id) ;
60
60
let prev = self . context . last_node_with_lint_attrs ;
61
61
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) ;
63
64
f ( self ) ;
64
- self . exit_attrs ( attrs) ;
65
+ debug ! ( "late context: exit_attrs({:?})" , attrs) ;
66
+ lint_callback ! ( self , exit_lint_attrs, attrs) ;
65
67
self . context . last_node_with_lint_attrs = prev;
66
68
}
67
69
@@ -81,16 +83,6 @@ impl<'tcx, T: LateLintPass<'tcx>> LateContextAndPass<'tcx, T> {
81
83
hir_visit:: walk_mod ( self , m, n) ;
82
84
lint_callback ! ( self , check_mod_post, m, s, n) ;
83
85
}
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
- }
94
86
}
95
87
96
88
impl < ' 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
337
329
hir_visit:: walk_path ( self , p) ;
338
330
}
339
331
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) ;
344
334
}
345
335
}
346
336
@@ -402,7 +392,7 @@ fn late_lint_mod_pass<'tcx, T: LateLintPass<'tcx>>(
402
392
// Visit the crate attributes
403
393
if hir_id == hir:: CRATE_HIR_ID {
404
394
for attr in tcx. hir ( ) . attrs ( hir:: CRATE_HIR_ID ) . iter ( ) {
405
- cx. visit_attribute ( hir_id , attr)
395
+ cx. visit_attribute ( attr)
406
396
}
407
397
}
408
398
}
0 commit comments