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