File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -312,14 +312,17 @@ impl EarlyLintPass for MiscEarlyLints {
312
312
313
313
if let PatKind :: Ident ( _, ident, Some ( ref right) ) = pat. node {
314
314
if let PatKind :: Wild = right. node {
315
- span_lint (
315
+ span_lint_and_sugg (
316
316
cx,
317
317
REDUNDANT_PATTERN ,
318
318
pat. span ,
319
319
& format ! (
320
320
"the `{} @ _` pattern can be written as just `{}`" ,
321
321
ident. name, ident. name,
322
322
) ,
323
+ "try" ,
324
+ format ! ( "{}" , ident. name) ,
325
+ Applicability :: MachineApplicable ,
323
326
) ;
324
327
}
325
328
}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ error: the `y @ _` pattern can be written as just `y`
2
2
--> $DIR/patterns.rs:10:9
3
3
|
4
4
LL | y @ _ => (),
5
- | ^^^^^
5
+ | ^^^^^ help: try: `y`
6
6
|
7
7
= note: `-D clippy::redundant-pattern` implied by `-D warnings`
8
8
You can’t perform that action at this time.
0 commit comments