|
16 | 16 |
|
17 | 17 | use crate::{passes::LateLintPassObject, LateContext, LateLintPass, LintStore};
|
18 | 18 | use rustc_ast as ast;
|
19 |
| -use rustc_ast::walk_list; |
20 | 19 | use rustc_data_structures::sync::{join, par_iter, ParallelIterator};
|
21 | 20 | use rustc_hir as hir;
|
22 | 21 | use rustc_hir::def_id::{LocalDefId, LOCAL_CRATE};
|
@@ -333,8 +332,10 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
|
333 | 332 | hir_visit::walk_path(self, p);
|
334 | 333 | }
|
335 | 334 |
|
336 |
| - fn visit_attribute(&mut self, attr: &'tcx ast::Attribute) { |
337 |
| - lint_callback!(self, check_attribute, attr); |
| 335 | + fn visit_attribute(&mut self, hir_id: hir::HirId, attr: &'tcx ast::Attribute) { |
| 336 | + self.with_lint_attrs(hir_id, |cx| { |
| 337 | + lint_callback!(cx, check_attribute, attr); |
| 338 | + }) |
338 | 339 | }
|
339 | 340 | }
|
340 | 341 |
|
@@ -395,7 +396,9 @@ fn late_lint_mod_pass<'tcx, T: LateLintPass<'tcx>>(
|
395 | 396 |
|
396 | 397 | // Visit the crate attributes
|
397 | 398 | if hir_id == hir::CRATE_HIR_ID {
|
398 |
| - walk_list!(cx, visit_attribute, tcx.hir().attrs(hir::CRATE_HIR_ID)); |
| 399 | + for attr in tcx.hir().attrs(hir::CRATE_HIR_ID).iter() { |
| 400 | + cx.visit_attribute(hir_id, attr) |
| 401 | + } |
399 | 402 | }
|
400 | 403 | }
|
401 | 404 |
|
|
0 commit comments