Make it auto fixable lint

This commit is contained in:
Yuki Okushi 2019-09-05 00:50:22 +09:00
parent e236740f28
commit 8be37fdb1d
2 changed files with 5 additions and 2 deletions

View file

@ -312,7 +312,7 @@ impl EarlyLintPass for MiscEarlyLints {
if let PatKind::Ident(_, ident, Some(ref right)) = pat.node {
if let PatKind::Wild = right.node {
span_lint(
span_lint_and_sugg(
cx,
REDUNDANT_PATTERN,
pat.span,
@ -320,6 +320,9 @@ impl EarlyLintPass for MiscEarlyLints {
"the `{} @ _` pattern can be written as just `{}`",
ident.name, ident.name,
),
"try",
format!("{}", ident.name),
Applicability::MachineApplicable,
);
}
}

View file

@ -2,7 +2,7 @@ error: the `y @ _` pattern can be written as just `y`
--> $DIR/patterns.rs:10:9
|
LL | y @ _ => (),
| ^^^^^
| ^^^^^ help: try: `y`
|
= note: `-D clippy::redundant-pattern` implied by `-D warnings`