Skip to content

Commit 2a1962b

Browse files
committedApr 18, 2019
Use declare_lint_pass macro
1 parent 5a91136 commit 2a1962b

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed
 

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
99

10-
[There are 299 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
10+
[There are 300 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
1111

1212
We have a bunch of lint categories to allow you to choose how much Clippy is supposed to ~~annoy~~ help you:
1313

‎clippy_lints/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
575575
reg.register_late_lint_pass(box missing_const_for_fn::MissingConstForFn);
576576
reg.register_late_lint_pass(box transmuting_null::TransmutingNull);
577577
reg.register_late_lint_pass(box path_buf_push_overwrite::PathBufPushOverwrite);
578-
reg.register_late_lint_pass(box small_underscore_scope::Pass);
578+
reg.register_early_lint_pass(box small_underscore_scope::SmallUnderscoreScope);
579579

580580
reg.register_lint_group("clippy::restriction", Some("clippy_restriction"), vec![
581581
arithmetic::FLOAT_ARITHMETIC,

‎clippy_lints/src/small_underscore_scope.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::utils::span_lint_and_sugg;
22
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
3-
use rustc::{declare_tool_lint, lint_array};
3+
use rustc::{declare_lint_pass, declare_tool_lint};
44
use rustc_errors::Applicability;
55
use syntax::ast::*;
66
use syntax::source_map::Span;
@@ -28,20 +28,9 @@ declare_clippy_lint! {
2828
"wildcard binding occurs inside a struct, but the wildcard could be the entire binding"
2929
}
3030

31-
#[derive(Copy, Clone)]
32-
pub struct Pass;
31+
declare_lint_pass!(SmallUnderscoreScope => [SMALL_UNDERSCORE_SCOPE]);
3332

34-
impl LintPass for Pass {
35-
fn get_lints(&self) -> LintArray {
36-
lint_array!(SMALL_UNDERSCORE_SCOPE,)
37-
}
38-
39-
fn name(&self) -> &'static str {
40-
"SmallUnderscoreScope"
41-
}
42-
}
43-
44-
impl EarlyLintPass for Pass {
33+
impl EarlyLintPass for SmallUnderscoreScope {
4534
fn check_pat(&mut self, cx: &EarlyContext<'_>, pat: &Pat, _: &mut bool) {
4635
match pat.node {
4736
PatKind::TupleStruct(_, ref pats, _) | PatKind::Tuple(ref pats, _) => {

0 commit comments

Comments
 (0)