@@ -17,7 +17,7 @@ mod useless_attribute;
1717mod utils;
1818
1919use clippy_config:: msrvs:: Msrv ;
20- use rustc_ast:: { Attribute , Crate , MetaItemKind , NestedMetaItem } ;
20+ use rustc_ast:: { Attribute , MetaItemKind , NestedMetaItem } ;
2121use rustc_hir:: { ImplItem , Item , ItemKind , TraitItem } ;
2222use rustc_lint:: { EarlyContext , EarlyLintPass , LateContext , LateLintPass } ;
2323use rustc_session:: { declare_lint_pass, impl_lint_pass} ;
@@ -534,11 +534,13 @@ declare_lint_pass!(Attributes => [
534534BLANKET_CLIPPY_RESTRICTION_LINTS ,
535535SHOULD_PANIC_WITHOUT_EXPECT ,
536536MIXED_ATTRIBUTES_STYLE ,
537+ DUPLICATED_ATTRIBUTES ,
537538] ) ;
538539
539540impl < ' tcx > LateLintPass < ' tcx > for Attributes {
540541fn check_crate ( & mut self , cx : & LateContext < ' tcx > ) {
541542 blanket_clippy_restriction_lints:: check_command_line ( cx) ;
543+ duplicated_attributes:: check ( cx, cx. tcx . hir ( ) . krate_attrs ( ) ) ;
542544}
543545
544546fn check_attribute ( & mut self , cx : & LateContext < ' tcx > , attr : & ' tcx Attribute ) {
@@ -578,6 +580,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
578580 _ => { } ,
579581}
580582 mixed_attributes_style:: check ( cx, item. span , attrs) ;
583+ duplicated_attributes:: check ( cx, attrs) ;
581584}
582585
583586fn check_impl_item ( & mut self , cx : & LateContext < ' tcx > , item : & ' tcx ImplItem < ' _ > ) {
@@ -606,17 +609,11 @@ impl_lint_pass!(EarlyAttributes => [
606609MAYBE_MISUSED_CFG ,
607610DEPRECATED_CLIPPY_CFG_ATTR ,
608611UNNECESSARY_CLIPPY_CFG ,
609- DUPLICATED_ATTRIBUTES ,
610612] ) ;
611613
612614impl EarlyLintPass for EarlyAttributes {
613- fn check_crate ( & mut self , cx : & EarlyContext < ' _ > , krate : & Crate ) {
614- duplicated_attributes:: check ( cx, & krate. attrs ) ;
615- }
616-
617615fn check_item ( & mut self , cx : & EarlyContext < ' _ > , item : & rustc_ast:: Item ) {
618616 empty_line_after:: check ( cx, item) ;
619- duplicated_attributes:: check ( cx, & item. attrs ) ;
620617}
621618
622619fn check_attribute ( & mut self , cx : & EarlyContext < ' _ > , attr : & Attribute ) {
0 commit comments