]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` |
2 | --> $DIR/single_match.rs:8:5 | |
3 | | | |
4 | LL | / match x { | |
5 | LL | | Some(y) => { | |
6 | LL | | println!("{:?}", y); | |
7 | LL | | }, | |
8 | LL | | _ => (), | |
9 | LL | | }; | |
10 | | |_____^ | |
11 | | | |
12 | = note: `-D clippy::single-match` implied by `-D warnings` | |
13 | help: try this | |
14 | | | |
15 | LL | if let Some(y) = x { | |
16 | LL | println!("{:?}", y); | |
17 | LL | }; | |
18 | | | |
19 | ||
20 | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` | |
21 | --> $DIR/single_match.rs:16:5 | |
22 | | | |
23 | LL | / match x { | |
24 | LL | | // Note the missing block braces. | |
25 | LL | | // We suggest `if let Some(y) = x { .. }` because the macro | |
26 | LL | | // is expanded before we can do anything. | |
27 | LL | | Some(y) => println!("{:?}", y), | |
28 | LL | | _ => (), | |
29 | LL | | } | |
30 | | |_____^ help: try this: `if let Some(y) = x { println!("{:?}", y) }` | |
31 | ||
32 | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` | |
33 | --> $DIR/single_match.rs:25:5 | |
34 | | | |
35 | LL | / match z { | |
36 | LL | | (2..=3, 7..=9) => dummy(), | |
37 | LL | | _ => {}, | |
38 | LL | | }; | |
39 | | |_____^ help: try this: `if let (2..=3, 7..=9) = z { dummy() }` | |
40 | ||
41 | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` | |
42 | --> $DIR/single_match.rs:54:5 | |
43 | | | |
44 | LL | / match x { | |
45 | LL | | Some(y) => dummy(), | |
46 | LL | | None => (), | |
47 | LL | | }; | |
48 | | |_____^ help: try this: `if let Some(y) = x { dummy() }` | |
49 | ||
50 | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` | |
51 | --> $DIR/single_match.rs:59:5 | |
52 | | | |
53 | LL | / match y { | |
54 | LL | | Ok(y) => dummy(), | |
55 | LL | | Err(..) => (), | |
56 | LL | | }; | |
57 | | |_____^ help: try this: `if let Ok(y) = y { dummy() }` | |
58 | ||
59 | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` | |
60 | --> $DIR/single_match.rs:66:5 | |
61 | | | |
62 | LL | / match c { | |
63 | LL | | Cow::Borrowed(..) => dummy(), | |
64 | LL | | Cow::Owned(..) => (), | |
65 | LL | | }; | |
66 | | |_____^ help: try this: `if let Cow::Borrowed(..) = c { dummy() }` | |
67 | ||
68 | error: you seem to be trying to use `match` for an equality check. Consider using `if` | |
69 | --> $DIR/single_match.rs:87:5 | |
70 | | | |
71 | LL | / match x { | |
72 | LL | | "test" => println!(), | |
73 | LL | | _ => (), | |
74 | LL | | } | |
75 | | |_____^ help: try this: `if x == "test" { println!() }` | |
76 | ||
77 | error: you seem to be trying to use `match` for an equality check. Consider using `if` | |
78 | --> $DIR/single_match.rs:100:5 | |
79 | | | |
80 | LL | / match x { | |
81 | LL | | Foo::A => println!(), | |
82 | LL | | _ => (), | |
83 | LL | | } | |
84 | | |_____^ help: try this: `if x == Foo::A { println!() }` | |
85 | ||
86 | error: you seem to be trying to use `match` for an equality check. Consider using `if` | |
87 | --> $DIR/single_match.rs:106:5 | |
88 | | | |
89 | LL | / match x { | |
90 | LL | | FOO_C => println!(), | |
91 | LL | | _ => (), | |
92 | LL | | } | |
93 | | |_____^ help: try this: `if x == FOO_C { println!() }` | |
94 | ||
95 | error: you seem to be trying to use `match` for an equality check. Consider using `if` | |
96 | --> $DIR/single_match.rs:111:5 | |
97 | | | |
98 | LL | / match &&x { | |
99 | LL | | Foo::A => println!(), | |
100 | LL | | _ => (), | |
101 | LL | | } | |
102 | | |_____^ help: try this: `if x == Foo::A { println!() }` | |
103 | ||
104 | error: you seem to be trying to use `match` for an equality check. Consider using `if` | |
105 | --> $DIR/single_match.rs:117:5 | |
106 | | | |
107 | LL | / match &x { | |
108 | LL | | Foo::A => println!(), | |
109 | LL | | _ => (), | |
110 | LL | | } | |
111 | | |_____^ help: try this: `if x == &Foo::A { println!() }` | |
112 | ||
113 | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` | |
114 | --> $DIR/single_match.rs:134:5 | |
115 | | | |
116 | LL | / match x { | |
117 | LL | | Bar::A => println!(), | |
118 | LL | | _ => (), | |
119 | LL | | } | |
120 | | |_____^ help: try this: `if let Bar::A = x { println!() }` | |
121 | ||
122 | error: aborting due to 12 previous errors | |
123 |