@@ -566,11 +566,12 @@ struct LintLevelMapBuilder<'a, 'tcx> {
566
566
}
567
567
568
568
impl LintLevelMapBuilder < ' _ , ' _ > {
569
- fn with_lint_attrs < F > ( & mut self , id : hir:: HirId , attrs : & [ ast :: Attribute ] , f : F )
569
+ fn with_lint_attrs < F > ( & mut self , id : hir:: HirId , f : F )
570
570
where
571
571
F : FnOnce ( & mut Self ) ,
572
572
{
573
573
let is_crate_hir = id == hir:: CRATE_HIR_ID ;
574
+ let attrs = self . tcx . hir ( ) . attrs ( id) ;
574
575
let push = self . levels . push ( attrs, self . store , is_crate_hir) ;
575
576
if push. changed {
576
577
self . levels . register_id ( id) ;
@@ -588,19 +589,19 @@ impl<'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'_, 'tcx> {
588
589
}
589
590
590
591
fn visit_param ( & mut self , param : & ' tcx hir:: Param < ' tcx > ) {
591
- self . with_lint_attrs ( param. hir_id , & param . attrs , |builder| {
592
+ self . with_lint_attrs ( param. hir_id , |builder| {
592
593
intravisit:: walk_param ( builder, param) ;
593
594
} ) ;
594
595
}
595
596
596
597
fn visit_item ( & mut self , it : & ' tcx hir:: Item < ' tcx > ) {
597
- self . with_lint_attrs ( it. hir_id ( ) , & it . attrs , |builder| {
598
+ self . with_lint_attrs ( it. hir_id ( ) , |builder| {
598
599
intravisit:: walk_item ( builder, it) ;
599
600
} ) ;
600
601
}
601
602
602
603
fn visit_foreign_item ( & mut self , it : & ' tcx hir:: ForeignItem < ' tcx > ) {
603
- self . with_lint_attrs ( it. hir_id ( ) , & it . attrs , |builder| {
604
+ self . with_lint_attrs ( it. hir_id ( ) , |builder| {
604
605
intravisit:: walk_foreign_item ( builder, it) ;
605
606
} )
606
607
}
@@ -613,13 +614,13 @@ impl<'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'_, 'tcx> {
613
614
}
614
615
615
616
fn visit_expr ( & mut self , e : & ' tcx hir:: Expr < ' tcx > ) {
616
- self . with_lint_attrs ( e. hir_id , & e . attrs , |builder| {
617
+ self . with_lint_attrs ( e. hir_id , |builder| {
617
618
intravisit:: walk_expr ( builder, e) ;
618
619
} )
619
620
}
620
621
621
622
fn visit_struct_field ( & mut self , s : & ' tcx hir:: StructField < ' tcx > ) {
622
- self . with_lint_attrs ( s. hir_id , & s . attrs , |builder| {
623
+ self . with_lint_attrs ( s. hir_id , |builder| {
623
624
intravisit:: walk_struct_field ( builder, s) ;
624
625
} )
625
626
}
@@ -630,31 +631,31 @@ impl<'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'_, 'tcx> {
630
631
g : & ' tcx hir:: Generics < ' tcx > ,
631
632
item_id : hir:: HirId ,
632
633
) {
633
- self . with_lint_attrs ( v. id , & v . attrs , |builder| {
634
+ self . with_lint_attrs ( v. id , |builder| {
634
635
intravisit:: walk_variant ( builder, v, g, item_id) ;
635
636
} )
636
637
}
637
638
638
639
fn visit_local ( & mut self , l : & ' tcx hir:: Local < ' tcx > ) {
639
- self . with_lint_attrs ( l. hir_id , & l . attrs , |builder| {
640
+ self . with_lint_attrs ( l. hir_id , |builder| {
640
641
intravisit:: walk_local ( builder, l) ;
641
642
} )
642
643
}
643
644
644
645
fn visit_arm ( & mut self , a : & ' tcx hir:: Arm < ' tcx > ) {
645
- self . with_lint_attrs ( a. hir_id , & a . attrs , |builder| {
646
+ self . with_lint_attrs ( a. hir_id , |builder| {
646
647
intravisit:: walk_arm ( builder, a) ;
647
648
} )
648
649
}
649
650
650
651
fn visit_trait_item ( & mut self , trait_item : & ' tcx hir:: TraitItem < ' tcx > ) {
651
- self . with_lint_attrs ( trait_item. hir_id ( ) , & trait_item . attrs , |builder| {
652
+ self . with_lint_attrs ( trait_item. hir_id ( ) , |builder| {
652
653
intravisit:: walk_trait_item ( builder, trait_item) ;
653
654
} ) ;
654
655
}
655
656
656
657
fn visit_impl_item ( & mut self , impl_item : & ' tcx hir:: ImplItem < ' tcx > ) {
657
- self . with_lint_attrs ( impl_item. hir_id ( ) , & impl_item . attrs , |builder| {
658
+ self . with_lint_attrs ( impl_item. hir_id ( ) , |builder| {
658
659
intravisit:: walk_impl_item ( builder, impl_item) ;
659
660
} ) ;
660
661
}
0 commit comments