@@ -17,7 +17,7 @@ mod useless_attribute;
17
17
mod utils;
18
18
19
19
use clippy_config:: msrvs:: Msrv ;
20
- use rustc_ast:: { Attribute , Crate , MetaItemKind , NestedMetaItem } ;
20
+ use rustc_ast:: { Attribute , MetaItemKind , NestedMetaItem } ;
21
21
use rustc_hir:: { ImplItem , Item , ItemKind , TraitItem } ;
22
22
use rustc_lint:: { EarlyContext , EarlyLintPass , LateContext , LateLintPass } ;
23
23
use rustc_session:: { declare_lint_pass, impl_lint_pass} ;
@@ -534,11 +534,13 @@ declare_lint_pass!(Attributes => [
534
534
BLANKET_CLIPPY_RESTRICTION_LINTS ,
535
535
SHOULD_PANIC_WITHOUT_EXPECT ,
536
536
MIXED_ATTRIBUTES_STYLE ,
537
+ DUPLICATED_ATTRIBUTES ,
537
538
] ) ;
538
539
539
540
impl < ' tcx > LateLintPass < ' tcx > for Attributes {
540
541
fn check_crate ( & mut self , cx : & LateContext < ' tcx > ) {
541
542
blanket_clippy_restriction_lints:: check_command_line ( cx) ;
543
+ duplicated_attributes:: check ( cx, cx. tcx . hir ( ) . krate_attrs ( ) ) ;
542
544
}
543
545
544
546
fn check_attribute ( & mut self , cx : & LateContext < ' tcx > , attr : & ' tcx Attribute ) {
@@ -578,6 +580,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
578
580
_ => { } ,
579
581
}
580
582
mixed_attributes_style:: check ( cx, item. span , attrs) ;
583
+ duplicated_attributes:: check ( cx, attrs) ;
581
584
}
582
585
583
586
fn check_impl_item ( & mut self , cx : & LateContext < ' tcx > , item : & ' tcx ImplItem < ' _ > ) {
@@ -606,17 +609,11 @@ impl_lint_pass!(EarlyAttributes => [
606
609
MAYBE_MISUSED_CFG ,
607
610
DEPRECATED_CLIPPY_CFG_ATTR ,
608
611
UNNECESSARY_CLIPPY_CFG ,
609
- DUPLICATED_ATTRIBUTES ,
610
612
] ) ;
611
613
612
614
impl EarlyLintPass for EarlyAttributes {
613
- fn check_crate ( & mut self , cx : & EarlyContext < ' _ > , krate : & Crate ) {
614
- duplicated_attributes:: check ( cx, & krate. attrs ) ;
615
- }
616
-
617
615
fn check_item ( & mut self , cx : & EarlyContext < ' _ > , item : & rustc_ast:: Item ) {
618
616
empty_line_after:: check ( cx, item) ;
619
- duplicated_attributes:: check ( cx, & item. attrs ) ;
620
617
}
621
618
622
619
fn check_attribute ( & mut self , cx : & EarlyContext < ' _ > , attr : & Attribute ) {
0 commit comments