forked from rust-lang/rust
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the redundant_wildcard_enum_match lint
- Loading branch information
1 parent
e1842b0
commit 94e4b5e
Showing
7 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// run-rustfix | ||
|
||
#![warn(clippy::match_wildcard_for_single_variants)] | ||
#![allow(dead_code)] | ||
|
||
enum Foo { | ||
A, | ||
B, | ||
C, | ||
} | ||
|
||
fn main() { | ||
match Foo::A { | ||
Foo::A => {}, | ||
Foo::B => {}, | ||
Foo::C => {}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// run-rustfix | ||
|
||
#![warn(clippy::match_wildcard_for_single_variants)] | ||
#![allow(dead_code)] | ||
|
||
enum Foo { | ||
A, | ||
B, | ||
C, | ||
} | ||
|
||
fn main() { | ||
match Foo::A { | ||
Foo::A => {}, | ||
Foo::B => {}, | ||
_ => {}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: wildcard match will miss any future added variants | ||
--> $DIR/match_wildcard_for_single_variants.rs:16:9 | ||
| | ||
LL | _ => {}, | ||
| ^ help: try this: `Foo::C` | ||
| | ||
= note: `-D clippy::match-wildcard-for-single-variants` implied by `-D warnings` | ||
|
||
error: aborting due to previous error | ||
|