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