@@ -12,7 +12,7 @@ use rustc::lint::{
12
12
LintContext , LintPass ,
13
13
} ;
14
14
use rustc:: ty;
15
- use rustc:: { declare_tool_lint , lint_array } ;
15
+ use rustc:: { declare_lint_pass , declare_tool_lint } ;
16
16
use rustc_errors:: Applicability ;
17
17
use semver:: Version ;
18
18
use syntax:: ast:: { AttrStyle , Attribute , Lit , LitKind , MetaItemKind , NestedMetaItem } ;
@@ -187,26 +187,15 @@ declare_clippy_lint! {
187
187
"usage of `cfg_attr(rustfmt)` instead of `tool_attributes`"
188
188
}
189
189
190
- #[ derive( Copy , Clone ) ]
191
- pub struct AttrPass ;
190
+ declare_lint_pass ! ( Attributes => [
191
+ INLINE_ALWAYS ,
192
+ DEPRECATED_SEMVER ,
193
+ USELESS_ATTRIBUTE ,
194
+ EMPTY_LINE_AFTER_OUTER_ATTR ,
195
+ UNKNOWN_CLIPPY_LINTS ,
196
+ ] ) ;
192
197
193
- impl LintPass for AttrPass {
194
- fn get_lints ( & self ) -> LintArray {
195
- lint_array ! (
196
- INLINE_ALWAYS ,
197
- DEPRECATED_SEMVER ,
198
- USELESS_ATTRIBUTE ,
199
- EMPTY_LINE_AFTER_OUTER_ATTR ,
200
- UNKNOWN_CLIPPY_LINTS ,
201
- )
202
- }
203
-
204
- fn name ( & self ) -> & ' static str {
205
- "Attributes"
206
- }
207
- }
208
-
209
- impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for AttrPass {
198
+ impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for Attributes {
210
199
fn check_attribute ( & mut self , cx : & LateContext < ' a , ' tcx > , attr : & ' tcx Attribute ) {
211
200
if let Some ( items) = & attr. meta_item_list ( ) {
212
201
if let Some ( ident) = attr. ident ( ) {
@@ -506,20 +495,9 @@ fn is_present_in_source(cx: &LateContext<'_, '_>, span: Span) -> bool {
506
495
true
507
496
}
508
497
509
- #[ derive( Copy , Clone ) ]
510
- pub struct CfgAttrPass ;
511
-
512
- impl LintPass for CfgAttrPass {
513
- fn get_lints ( & self ) -> LintArray {
514
- lint_array ! ( DEPRECATED_CFG_ATTR , )
515
- }
516
-
517
- fn name ( & self ) -> & ' static str {
518
- "DeprecatedCfgAttribute"
519
- }
520
- }
498
+ declare_lint_pass ! ( DeprecatedCfgAttribute => [ DEPRECATED_CFG_ATTR ] ) ;
521
499
522
- impl EarlyLintPass for CfgAttrPass {
500
+ impl EarlyLintPass for DeprecatedCfgAttribute {
523
501
fn check_attribute ( & mut self , cx : & EarlyContext < ' _ > , attr : & Attribute ) {
524
502
if_chain ! {
525
503
// check cfg_attr
0 commit comments