]> git.lizzy.rs Git - rust.git/blob - tests/ui/matches.stderr
Lint on `Err(_)` arm of a match
[rust.git] / tests / ui / matches.stderr
1 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
2   --> $DIR/matches.rs:26:5
3    |
4 26 |       match ExprNode::Butterflies {
5    |  _____^ starting here...
6 27 | |
7 28 | |
8 29 | |
9 30 | |         ExprNode::ExprAddrOf => Some(&NODE),
10 31 | |         _ => { let x = 5; None },
11 32 | |     }
12    | |_____^ ...ending here
13    |
14 note: lint level defined here
15   --> $DIR/matches.rs:7:9
16    |
17 7  | #![deny(single_match_else)]
18    |         ^^^^^^^^^^^^^^^^^
19 help: try this
20    |     if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else { let x = 5; None }
21
22 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
23   --> $DIR/matches.rs:38:5
24    |
25 38 |       match x {
26    |  _____^ starting here...
27 39 | |
28 40 | |
29 41 | |
30 42 | |         Some(y) => { println!("{:?}", y); }
31 43 | |         _ => ()
32 44 | |     };
33    | |_____^ ...ending here
34    |
35    = note: #[deny(single_match)] implied by #[deny(clippy)]
36 note: lint level defined here
37   --> $DIR/matches.rs:5:9
38    |
39 5  | #![deny(clippy)]
40    |         ^^^^^^
41 help: try this
42    |     if let Some(y) = x { println!("{:?}", y); };
43
44 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
45   --> $DIR/matches.rs:47:5
46    |
47 47 |       match z {
48    |  _____^ starting here...
49 48 | |
50 49 | |
51 50 | |
52 51 | |         (2...3, 7...9) => dummy(),
53 52 | |         _ => {}
54 53 | |     };
55    | |_____^ ...ending here
56    |
57    = note: #[deny(single_match)] implied by #[deny(clippy)]
58 help: try this
59    |     if let (2...3, 7...9) = z { dummy() };
60
61 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
62   --> $DIR/matches.rs:72:5
63    |
64 72 |       match x {
65    |  _____^ starting here...
66 73 | |
67 74 | |
68 75 | |
69 76 | |         Some(y) => dummy(),
70 77 | |         None => ()
71 78 | |     };
72    | |_____^ ...ending here
73    |
74    = note: #[deny(single_match)] implied by #[deny(clippy)]
75 help: try this
76    |     if let Some(y) = x { dummy() };
77
78 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
79   --> $DIR/matches.rs:80:5
80    |
81 80 |       match y {
82    |  _____^ starting here...
83 81 | |
84 82 | |
85 83 | |
86 84 | |         Ok(y) => dummy(),
87 85 | |         Err(..) => ()
88 86 | |     };
89    | |_____^ ...ending here
90    |
91    = note: #[deny(single_match)] implied by #[deny(clippy)]
92 help: try this
93    |     if let Ok(y) = y { dummy() };
94
95 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
96   --> $DIR/matches.rs:90:5
97    |
98 90 |       match c {
99    |  _____^ starting here...
100 91 | |
101 92 | |
102 93 | |
103 94 | |         Cow::Borrowed(..) => dummy(),
104 95 | |         Cow::Owned(..) => (),
105 96 | |     };
106    | |_____^ ...ending here
107    |
108    = note: #[deny(single_match)] implied by #[deny(clippy)]
109 help: try this
110    |     if let Cow::Borrowed(..) = c { dummy() };
111
112 error: you seem to be trying to match on a boolean expression
113    --> $DIR/matches.rs:114:5
114     |
115 114 |       match test {
116     |  _____^ starting here...
117 115 | |
118 116 | |
119 117 | |
120 118 | |         true => 0,
121 119 | |         false => 42,
122 120 | |     };
123     | |_____^ ...ending here
124     |
125     = note: #[deny(match_bool)] implied by #[deny(clippy)]
126 note: lint level defined here
127    --> $DIR/matches.rs:5:9
128     |
129 5   | #![deny(clippy)]
130     |         ^^^^^^
131 help: consider using an if/else expression
132     |     if test { 0 } else { 42 };
133
134 error: you seem to be trying to match on a boolean expression
135    --> $DIR/matches.rs:123:5
136     |
137 123 |       match option == 1 {
138     |  _____^ starting here...
139 124 | |
140 125 | |
141 126 | |
142 127 | |         true => 1,
143 128 | |         false => 0,
144 129 | |     };
145     | |_____^ ...ending here
146     |
147     = note: #[deny(match_bool)] implied by #[deny(clippy)]
148 help: consider using an if/else expression
149     |     if option == 1 { 1 } else { 0 };
150
151 error: you seem to be trying to match on a boolean expression
152    --> $DIR/matches.rs:131:5
153     |
154 131 |       match test {
155     |  _____^ starting here...
156 132 | |
157 133 | |
158 134 | |
159 135 | |         true => (),
160 136 | |         false => { println!("Noooo!"); }
161 137 | |     };
162     | |_____^ ...ending here
163     |
164     = note: #[deny(match_bool)] implied by #[deny(clippy)]
165 help: consider using an if/else expression
166     |     if !test { println!("Noooo!"); };
167
168 error: you seem to be trying to match on a boolean expression
169    --> $DIR/matches.rs:139:5
170     |
171 139 |       match test {
172     |  _____^ starting here...
173 140 | |
174 141 | |
175 142 | |
176 143 | |         false => { println!("Noooo!"); }
177 144 | |         _ => (),
178 145 | |     };
179     | |_____^ ...ending here
180     |
181     = note: #[deny(match_bool)] implied by #[deny(clippy)]
182 help: consider using an if/else expression
183     |     if !test { println!("Noooo!"); };
184
185 error: you seem to be trying to match on a boolean expression
186    --> $DIR/matches.rs:147:5
187     |
188 147 |       match test && test {
189     |  _____^ starting here...
190 148 | |
191 149 | |
192 150 | |
193 151 | |
194 152 | |         false => { println!("Noooo!"); }
195 153 | |         _ => (),
196 154 | |     };
197     | |_____^ ...ending here
198     |
199     = note: #[deny(match_bool)] implied by #[deny(clippy)]
200 help: consider using an if/else expression
201     |     if !(test && test) { println!("Noooo!"); };
202
203 error: equal expressions as operands to `&&`
204    --> $DIR/matches.rs:147:11
205     |
206 147 |     match test && test {
207     |           ^^^^^^^^^^^^
208     |
209     = note: #[deny(eq_op)] implied by #[deny(clippy)]
210 note: lint level defined here
211    --> $DIR/matches.rs:5:9
212     |
213 5   | #![deny(clippy)]
214     |         ^^^^^^
215
216 error: you seem to be trying to match on a boolean expression
217    --> $DIR/matches.rs:156:5
218     |
219 156 |       match test {
220     |  _____^ starting here...
221 157 | |
222 158 | |
223 159 | |
224 160 | |         false => { println!("Noooo!"); }
225 161 | |         true => { println!("Yes!"); }
226 162 | |     };
227     | |_____^ ...ending here
228     |
229     = note: #[deny(match_bool)] implied by #[deny(clippy)]
230 help: consider using an if/else expression
231     |     if test { println!("Yes!"); } else { println!("Noooo!"); };
232
233 error: you don't need to add `&` to all patterns
234    --> $DIR/matches.rs:175:9
235     |
236 175 |           match v {
237     |  _________^ starting here...
238 176 | |
239 177 | |
240 178 | |
241 179 | |             &Some(v) => println!("{:?}", v),
242 180 | |             &None => println!("none"),
243 181 | |         }
244     | |_________^ ...ending here
245     |
246     = note: #[deny(match_ref_pats)] implied by #[deny(clippy)]
247 note: lint level defined here
248    --> $DIR/matches.rs:5:9
249     |
250 5   | #![deny(clippy)]
251     |         ^^^^^^
252 help: instead of prefixing all patterns with `&`, you can dereference the expression
253     |         match *v { .. }
254
255 error: you don't need to add `&` to all patterns
256    --> $DIR/matches.rs:188:5
257     |
258 188 |       match tup {
259     |  _____^ starting here...
260 189 | |
261 190 | |
262 191 | |
263 192 | |         &(v, 1) => println!("{}", v),
264 193 | |         _ => println!("none"),
265 194 | |     }
266     | |_____^ ...ending here
267     |
268     = note: #[deny(match_ref_pats)] implied by #[deny(clippy)]
269 help: instead of prefixing all patterns with `&`, you can dereference the expression
270     |     match *tup { .. }
271
272 error: you don't need to add `&` to both the expression and the patterns
273    --> $DIR/matches.rs:197:5
274     |
275 197 |       match &w {
276     |  _____^ starting here...
277 198 | |
278 199 | |
279 200 | |
280 201 | |         &Some(v) => println!("{:?}", v),
281 202 | |         &None => println!("none"),
282 203 | |     }
283     | |_____^ ...ending here
284     |
285     = note: #[deny(match_ref_pats)] implied by #[deny(clippy)]
286 help: try
287     |     match w { .. }
288
289 error: you don't need to add `&` to all patterns
290    --> $DIR/matches.rs:211:5
291     |
292 211 |       if let &None = a {
293     |  _____^ starting here...
294 212 | |
295 213 | |
296 214 | |
297 215 | |         println!("none");
298 216 | |     }
299     | |_____^ ...ending here
300     |
301     = note: #[deny(match_ref_pats)] implied by #[deny(clippy)]
302 help: instead of prefixing all patterns with `&`, you can dereference the expression
303     |     if let .. = *a { .. }
304
305 error: you don't need to add `&` to both the expression and the patterns
306    --> $DIR/matches.rs:219:5
307     |
308 219 |       if let &None = &b {
309     |  _____^ starting here...
310 220 | |
311 221 | |
312 222 | |
313 223 | |         println!("none");
314 224 | |     }
315     | |_____^ ...ending here
316     |
317     = note: #[deny(match_ref_pats)] implied by #[deny(clippy)]
318 help: try
319     |     if let .. = b { .. }
320
321 error: some ranges overlap
322    --> $DIR/matches.rs:231:9
323     |
324 231 |         0 ... 10 => println!("0 ... 10"),
325     |         ^^^^^^^^
326     |
327     = note: #[deny(match_overlapping_arm)] implied by #[deny(clippy)]
328 note: lint level defined here
329    --> $DIR/matches.rs:5:9
330     |
331 5   | #![deny(clippy)]
332     |         ^^^^^^
333 note: overlaps with this
334    --> $DIR/matches.rs:232:9
335     |
336 232 |         0 ... 11 => println!("0 ... 11"),
337     |         ^^^^^^^^
338
339 error: some ranges overlap
340    --> $DIR/matches.rs:237:9
341     |
342 237 |         0 ... 5 => println!("0 ... 5"),
343     |         ^^^^^^^
344     |
345     = note: #[deny(match_overlapping_arm)] implied by #[deny(clippy)]
346 note: overlaps with this
347    --> $DIR/matches.rs:239:9
348     |
349 239 |         FOO ... 11 => println!("0 ... 11"),
350     |         ^^^^^^^^^^
351
352 error: some ranges overlap
353    --> $DIR/matches.rs:245:9
354     |
355 245 |         0 ... 5 => println!("0 ... 5"),
356     |         ^^^^^^^
357     |
358     = note: #[deny(match_overlapping_arm)] implied by #[deny(clippy)]
359 note: overlaps with this
360    --> $DIR/matches.rs:244:9
361     |
362 244 |         2 => println!("2"),
363     |         ^
364
365 error: some ranges overlap
366    --> $DIR/matches.rs:251:9
367     |
368 251 |         0 ... 2 => println!("0 ... 2"),
369     |         ^^^^^^^
370     |
371     = note: #[deny(match_overlapping_arm)] implied by #[deny(clippy)]
372 note: overlaps with this
373    --> $DIR/matches.rs:250:9
374     |
375 250 |         2 => println!("2"),
376     |         ^
377
378 error: some ranges overlap
379    --> $DIR/matches.rs:274:9
380     |
381 274 |         0 .. 11 => println!("0 .. 11"),
382     |         ^^^^^^^
383     |
384     = note: #[deny(match_overlapping_arm)] implied by #[deny(clippy)]
385 note: overlaps with this
386    --> $DIR/matches.rs:275:9
387     |
388 275 |         0 ... 11 => println!("0 ... 11"),
389     |         ^^^^^^^^
390
391 error: Err(_) will match all errors, maybe not a good idea
392    --> $DIR/matches.rs:292:9
393     |
394 292 |         Err(_) => println!("err")
395     |         ^^^^^^
396     |
397     = note: #[deny(match_wild_err_arm)] implied by #[deny(clippy)]
398 note: lint level defined here
399    --> $DIR/matches.rs:5:9
400     |
401 5   | #![deny(clippy)]
402     |         ^^^^^^
403     = note: to remove this warning, match each error seperately or use unreachable macro
404
405 error: Err(_) will match all errors, maybe not a good idea
406    --> $DIR/matches.rs:298:9
407     |
408 298 |         Err(_) => {
409     |         ^^^^^^
410     |
411     = note: #[deny(match_wild_err_arm)] implied by #[deny(clippy)]
412     = note: to remove this warning, match each error seperately or use unreachable macro
413
414 error: aborting due to 25 previous errors
415