2020-01-05 14:05:16 +00:00
|
|
|
#![warn(clippy::wildcard_in_or_patterns)]
|
2019-12-24 15:42:09 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
match "foo" {
|
|
|
|
"a" => {
|
|
|
|
dbg!("matched a");
|
|
|
|
},
|
|
|
|
"bar" | _ => {
|
2023-07-28 19:35:48 +00:00
|
|
|
//~^ ERROR: wildcard pattern covers any other pattern as it will match anyway
|
2019-12-24 15:42:09 +00:00
|
|
|
dbg!("matched (bar or) wild");
|
|
|
|
},
|
|
|
|
};
|
|
|
|
match "foo" {
|
|
|
|
"a" => {
|
|
|
|
dbg!("matched a");
|
|
|
|
},
|
|
|
|
"bar" | "bar2" | _ => {
|
2023-07-28 19:35:48 +00:00
|
|
|
//~^ ERROR: wildcard pattern covers any other pattern as it will match anyway
|
2019-12-24 15:42:09 +00:00
|
|
|
dbg!("matched (bar or bar2 or) wild");
|
|
|
|
},
|
|
|
|
};
|
|
|
|
match "foo" {
|
|
|
|
"a" => {
|
|
|
|
dbg!("matched a");
|
|
|
|
},
|
|
|
|
_ | "bar" | _ => {
|
2023-07-28 19:35:48 +00:00
|
|
|
//~^ ERROR: wildcard pattern covers any other pattern as it will match anyway
|
2019-12-24 15:42:09 +00:00
|
|
|
dbg!("matched (bar or) wild");
|
|
|
|
},
|
|
|
|
};
|
|
|
|
match "foo" {
|
|
|
|
"a" => {
|
|
|
|
dbg!("matched a");
|
|
|
|
},
|
|
|
|
_ | "bar" => {
|
2023-07-28 19:35:48 +00:00
|
|
|
//~^ ERROR: wildcard pattern covers any other pattern as it will match anyway
|
2019-12-24 15:42:09 +00:00
|
|
|
dbg!("matched (bar or) wild");
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|