@@ -408,8 +408,8 @@ pub trait LintContext: Sized {
408
408
fn lints ( & self ) -> & LintStore ;
409
409
fn mut_lints ( & mut self ) -> & mut LintStore ;
410
410
fn level_stack ( & mut self ) -> & mut Vec < ( LintId , LevelSource ) > ;
411
- fn enter_attrs ( & mut self , attrs : & [ hir :: Attribute ] ) ;
412
- fn exit_attrs ( & mut self , attrs : & [ hir :: Attribute ] ) ;
411
+ fn enter_attrs ( & mut self , attrs : & [ ast :: Attribute ] ) ;
412
+ fn exit_attrs ( & mut self , attrs : & [ ast :: Attribute ] ) ;
413
413
414
414
/// Get the level of `lint` at the current position of the lint
415
415
/// traversal.
@@ -510,14 +510,6 @@ pub trait LintContext: Sized {
510
510
self . mut_lints ( ) . set_level ( lint, lvlsrc) ;
511
511
}
512
512
}
513
-
514
- fn with_ast_lint_attrs < F > ( & mut self ,
515
- attrs : & [ ast:: Attribute ] ,
516
- f : F )
517
- where F : FnOnce ( & mut Self ) ,
518
- {
519
- self . with_lint_attrs ( & lower_attrs ( attrs) , f)
520
- }
521
513
}
522
514
523
515
@@ -596,11 +588,11 @@ impl<'a, 'tcx> LintContext for LateContext<'a, 'tcx> {
596
588
& mut self . level_stack
597
589
}
598
590
599
- fn enter_attrs ( & mut self , attrs : & [ hir :: Attribute ] ) {
591
+ fn enter_attrs ( & mut self , attrs : & [ ast :: Attribute ] ) {
600
592
run_lints ! ( self , enter_lint_attrs, late_passes, attrs) ;
601
593
}
602
594
603
- fn exit_attrs ( & mut self , attrs : & [ hir :: Attribute ] ) {
595
+ fn exit_attrs ( & mut self , attrs : & [ ast :: Attribute ] ) {
604
596
run_lints ! ( self , exit_lint_attrs, late_passes, attrs) ;
605
597
}
606
598
}
@@ -623,11 +615,11 @@ impl<'a> LintContext for EarlyContext<'a> {
623
615
& mut self . level_stack
624
616
}
625
617
626
- fn enter_attrs ( & mut self , attrs : & [ hir :: Attribute ] ) {
618
+ fn enter_attrs ( & mut self , attrs : & [ ast :: Attribute ] ) {
627
619
run_lints ! ( self , enter_lint_attrs, early_passes, attrs) ;
628
620
}
629
621
630
- fn exit_attrs ( & mut self , attrs : & [ hir :: Attribute ] ) {
622
+ fn exit_attrs ( & mut self , attrs : & [ ast :: Attribute ] ) {
631
623
run_lints ! ( self , exit_lint_attrs, early_passes, attrs) ;
632
624
}
633
625
}
@@ -782,15 +774,15 @@ impl<'a, 'tcx, 'v> hir_visit::Visitor<'v> for LateContext<'a, 'tcx> {
782
774
783
775
impl < ' a , ' v > ast_visit:: Visitor < ' v > for EarlyContext < ' a > {
784
776
fn visit_item ( & mut self , it : & ast:: Item ) {
785
- self . with_ast_lint_attrs ( & it. attrs , |cx| {
777
+ self . with_lint_attrs ( & it. attrs , |cx| {
786
778
run_lints ! ( cx, check_item, early_passes, it) ;
787
779
cx. visit_ids ( |v| v. visit_item ( it) ) ;
788
780
ast_visit:: walk_item ( cx, it) ;
789
781
} )
790
782
}
791
783
792
784
fn visit_foreign_item ( & mut self , it : & ast:: ForeignItem ) {
793
- self . with_ast_lint_attrs ( & it. attrs , |cx| {
785
+ self . with_lint_attrs ( & it. attrs , |cx| {
794
786
run_lints ! ( cx, check_foreign_item, early_passes, it) ;
795
787
ast_visit:: walk_foreign_item ( cx, it) ;
796
788
} )
@@ -828,14 +820,14 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
828
820
}
829
821
830
822
fn visit_struct_field ( & mut self , s : & ast:: StructField ) {
831
- self . with_ast_lint_attrs ( & s. node . attrs , |cx| {
823
+ self . with_lint_attrs ( & s. node . attrs , |cx| {
832
824
run_lints ! ( cx, check_struct_field, early_passes, s) ;
833
825
ast_visit:: walk_struct_field ( cx, s) ;
834
826
} )
835
827
}
836
828
837
829
fn visit_variant ( & mut self , v : & ast:: Variant , g : & ast:: Generics ) {
838
- self . with_ast_lint_attrs ( & v. node . attrs , |cx| {
830
+ self . with_lint_attrs ( & v. node . attrs , |cx| {
839
831
run_lints ! ( cx, check_variant, early_passes, v, g) ;
840
832
ast_visit:: walk_variant ( cx, v, g) ;
841
833
run_lints ! ( cx, check_variant_post, early_passes, v, g) ;
@@ -886,15 +878,15 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
886
878
}
887
879
888
880
fn visit_trait_item ( & mut self , trait_item : & ast:: TraitItem ) {
889
- self . with_ast_lint_attrs ( & trait_item. attrs , |cx| {
881
+ self . with_lint_attrs ( & trait_item. attrs , |cx| {
890
882
run_lints ! ( cx, check_trait_item, early_passes, trait_item) ;
891
883
cx. visit_ids ( |v| v. visit_trait_item ( trait_item) ) ;
892
884
ast_visit:: walk_trait_item ( cx, trait_item) ;
893
885
} ) ;
894
886
}
895
887
896
888
fn visit_impl_item ( & mut self , impl_item : & ast:: ImplItem ) {
897
- self . with_ast_lint_attrs ( & impl_item. attrs , |cx| {
889
+ self . with_lint_attrs ( & impl_item. attrs , |cx| {
898
890
run_lints ! ( cx, check_impl_item, early_passes, impl_item) ;
899
891
cx. visit_ids ( |v| v. visit_impl_item ( impl_item) ) ;
900
892
ast_visit:: walk_impl_item ( cx, impl_item) ;
@@ -1027,7 +1019,7 @@ pub fn check_ast_crate(sess: &Session, krate: &ast::Crate) {
1027
1019
let mut cx = EarlyContext :: new ( sess, krate) ;
1028
1020
1029
1021
// Visit the whole crate.
1030
- cx. with_ast_lint_attrs ( & krate. attrs , |cx| {
1022
+ cx. with_lint_attrs ( & krate. attrs , |cx| {
1031
1023
cx. visit_id ( ast:: CRATE_NODE_ID ) ;
1032
1024
cx. visit_ids ( |v| {
1033
1025
v. visited_outermost = true ;
0 commit comments