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