blob: f8bb31b83c48b5928e7ba9b723a5104037f9347c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#![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");
},
};
}
|