We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e236740 commit 8be37fdCopy full SHA for 8be37fd
clippy_lints/src/misc_early.rs
@@ -312,14 +312,17 @@ impl EarlyLintPass for MiscEarlyLints {
312
313
if let PatKind::Ident(_, ident, Some(ref right)) = pat.node {
314
if let PatKind::Wild = right.node {
315
- span_lint(
+ span_lint_and_sugg(
316
cx,
317
REDUNDANT_PATTERN,
318
pat.span,
319
&format!(
320
"the `{} @ _` pattern can be written as just `{}`",
321
ident.name, ident.name,
322
),
323
+ "try",
324
+ format!("{}", ident.name),
325
+ Applicability::MachineApplicable,
326
);
327
}
328
tests/ui/patterns.stderr
@@ -2,7 +2,7 @@ error: the `y @ _` pattern can be written as just `y`
2
--> $DIR/patterns.rs:10:9
3
|
4
LL | y @ _ => (),
5
- | ^^^^^
+ | ^^^^^ help: try: `y`
6
7
= note: `-D clippy::redundant-pattern` implied by `-D warnings`
8
0 commit comments