mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
40 lines
1.1 KiB
Rust
40 lines
1.1 KiB
Rust
#![warn(clippy::wildcard_in_or_patterns)]
|
|
|
|
fn main() {
|
|
match "foo" {
|
|
"a" => {
|
|
dbg!("matched a");
|
|
},
|
|
"bar" | _ => {
|
|
//~^ ERROR: wildcard pattern covers any other pattern as it will match anyway
|
|
dbg!("matched (bar or) wild");
|
|
},
|
|
};
|
|
match "foo" {
|
|
"a" => {
|
|
dbg!("matched a");
|
|
},
|
|
"bar" | "bar2" | _ => {
|
|
//~^ ERROR: wildcard pattern covers any other pattern as it will match anyway
|
|
dbg!("matched (bar or bar2 or) wild");
|
|
},
|
|
};
|
|
match "foo" {
|
|
"a" => {
|
|
dbg!("matched a");
|
|
},
|
|
_ | "bar" | _ => {
|
|
//~^ ERROR: wildcard pattern covers any other pattern as it will match anyway
|
|
dbg!("matched (bar or) wild");
|
|
},
|
|
};
|
|
match "foo" {
|
|
"a" => {
|
|
dbg!("matched a");
|
|
},
|
|
_ | "bar" => {
|
|
//~^ ERROR: wildcard pattern covers any other pattern as it will match anyway
|
|
dbg!("matched (bar or) wild");
|
|
},
|
|
};
|
|
}
|