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