]> git.lizzy.rs Git - rust.git/blob - tests/ui/matches.stderr
Split up match_bool UI tests
[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: you don't need to add `&` to all patterns
13   --> $DIR/matches.rs:30:9
14    |
15 30 | /         match v {
16 31 | |             &Some(v) => println!("{:?}", v),
17 32 | |             &None => println!("none"),
18 33 | |         }
19    | |_________^
20    |
21    = note: `-D match-ref-pats` implied by `-D warnings`
22 help: instead of prefixing all patterns with `&`, you can dereference the expression
23    |
24 30 |         match *v {
25 31 |             Some(v) => println!("{:?}", v),
26 32 |             None => println!("none"),
27    |
28
29 error: you don't need to add `&` to all patterns
30   --> $DIR/matches.rs:40:5
31    |
32 40 | /     match tup {
33 41 | |         &(v, 1) => println!("{}", v),
34 42 | |         _ => println!("none"),
35 43 | |     }
36    | |_____^
37 help: instead of prefixing all patterns with `&`, you can dereference the expression
38    |
39 40 |     match *tup {
40 41 |         (v, 1) => println!("{}", v),
41    |
42
43 error: you don't need to add `&` to both the expression and the patterns
44   --> $DIR/matches.rs:46:5
45    |
46 46 | /     match &w {
47 47 | |         &Some(v) => println!("{:?}", v),
48 48 | |         &None => println!("none"),
49 49 | |     }
50    | |_____^
51 help: try
52    |
53 46 |     match w {
54 47 |         Some(v) => println!("{:?}", v),
55 48 |         None => println!("none"),
56    |
57
58 error: you don't need to add `&` to all patterns
59   --> $DIR/matches.rs:57:5
60    |
61 57 | /     if let &None = a {
62 58 | |         println!("none");
63 59 | |     }
64    | |_____^
65 help: instead of prefixing all patterns with `&`, you can dereference the expression
66    |
67 57 |     if let None = *a {
68    |
69
70 error: you don't need to add `&` to both the expression and the patterns
71   --> $DIR/matches.rs:62:5
72    |
73 62 | /     if let &None = &b {
74 63 | |         println!("none");
75 64 | |     }
76    | |_____^
77 help: try
78    |
79 62 |     if let None = b {
80    |
81
82 error: some ranges overlap
83   --> $DIR/matches.rs:71:9
84    |
85 71 |         0 ... 10 => println!("0 ... 10"),
86    |         ^^^^^^^^
87    |
88    = note: `-D match-overlapping-arm` implied by `-D warnings`
89 note: overlaps with this
90   --> $DIR/matches.rs:72:9
91    |
92 72 |         0 ... 11 => println!("0 ... 11"),
93    |         ^^^^^^^^
94
95 error: some ranges overlap
96   --> $DIR/matches.rs:77:9
97    |
98 77 |         0 ... 5 => println!("0 ... 5"),
99    |         ^^^^^^^
100    |
101 note: overlaps with this
102   --> $DIR/matches.rs:79:9
103    |
104 79 |         FOO ... 11 => println!("0 ... 11"),
105    |         ^^^^^^^^^^
106
107 error: some ranges overlap
108   --> $DIR/matches.rs:85:9
109    |
110 85 |         0 ... 5 => println!("0 ... 5"),
111    |         ^^^^^^^
112    |
113 note: overlaps with this
114   --> $DIR/matches.rs:84:9
115    |
116 84 |         2 => println!("2"),
117    |         ^
118
119 error: some ranges overlap
120   --> $DIR/matches.rs:91:9
121    |
122 91 |         0 ... 2 => println!("0 ... 2"),
123    |         ^^^^^^^
124    |
125 note: overlaps with this
126   --> $DIR/matches.rs:90:9
127    |
128 90 |         2 => println!("2"),
129    |         ^
130
131 error: some ranges overlap
132    --> $DIR/matches.rs:114:9
133     |
134 114 |         0 .. 11 => println!("0 .. 11"),
135     |         ^^^^^^^
136     |
137 note: overlaps with this
138    --> $DIR/matches.rs:115:9
139     |
140 115 |         0 ... 11 => println!("0 ... 11"),
141     |         ^^^^^^^^
142
143 error: Err(_) will match all errors, maybe not a good idea
144    --> $DIR/matches.rs:132:9
145     |
146 132 |         Err(_) => panic!("err")
147     |         ^^^^^^
148     |
149     = note: `-D match-wild-err-arm` implied by `-D warnings`
150     = note: to remove this warning, match each error seperately or use unreachable macro
151
152 error: this `match` has identical arm bodies
153    --> $DIR/matches.rs:131:18
154     |
155 131 |         Ok(_) => println!("ok"),
156     |                  ^^^^^^^^^^^^^^
157     |
158     = note: `-D match-same-arms` implied by `-D warnings`
159 note: same as this
160    --> $DIR/matches.rs:130:18
161     |
162 130 |         Ok(3) => println!("ok"),
163     |                  ^^^^^^^^^^^^^^
164 note: consider refactoring into `Ok(3) | Ok(_)`
165    --> $DIR/matches.rs:130:18
166     |
167 130 |         Ok(3) => println!("ok"),
168     |                  ^^^^^^^^^^^^^^
169     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
170
171 error: Err(_) will match all errors, maybe not a good idea
172    --> $DIR/matches.rs:138:9
173     |
174 138 |         Err(_) => {panic!()}
175     |         ^^^^^^
176     |
177     = note: to remove this warning, match each error seperately or use unreachable macro
178
179 error: this `match` has identical arm bodies
180    --> $DIR/matches.rs:137:18
181     |
182 137 |         Ok(_) => println!("ok"),
183     |                  ^^^^^^^^^^^^^^
184     |
185 note: same as this
186    --> $DIR/matches.rs:136:18
187     |
188 136 |         Ok(3) => println!("ok"),
189     |                  ^^^^^^^^^^^^^^
190 note: consider refactoring into `Ok(3) | Ok(_)`
191    --> $DIR/matches.rs:136:18
192     |
193 136 |         Ok(3) => println!("ok"),
194     |                  ^^^^^^^^^^^^^^
195     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
196
197 error: Err(_) will match all errors, maybe not a good idea
198    --> $DIR/matches.rs:144:9
199     |
200 144 |         Err(_) => {panic!();}
201     |         ^^^^^^
202     |
203     = note: to remove this warning, match each error seperately or use unreachable macro
204
205 error: this `match` has identical arm bodies
206    --> $DIR/matches.rs:143:18
207     |
208 143 |         Ok(_) => println!("ok"),
209     |                  ^^^^^^^^^^^^^^
210     |
211 note: same as this
212    --> $DIR/matches.rs:142:18
213     |
214 142 |         Ok(3) => println!("ok"),
215     |                  ^^^^^^^^^^^^^^
216 note: consider refactoring into `Ok(3) | Ok(_)`
217    --> $DIR/matches.rs:142:18
218     |
219 142 |         Ok(3) => println!("ok"),
220     |                  ^^^^^^^^^^^^^^
221     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
222
223 error: this `match` has identical arm bodies
224    --> $DIR/matches.rs:150:18
225     |
226 150 |         Ok(_) => println!("ok"),
227     |                  ^^^^^^^^^^^^^^
228     |
229 note: same as this
230    --> $DIR/matches.rs:149:18
231     |
232 149 |         Ok(3) => println!("ok"),
233     |                  ^^^^^^^^^^^^^^
234 note: consider refactoring into `Ok(3) | Ok(_)`
235    --> $DIR/matches.rs:149:18
236     |
237 149 |         Ok(3) => println!("ok"),
238     |                  ^^^^^^^^^^^^^^
239     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
240
241 error: this `match` has identical arm bodies
242    --> $DIR/matches.rs:157:18
243     |
244 157 |         Ok(_) => println!("ok"),
245     |                  ^^^^^^^^^^^^^^
246     |
247 note: same as this
248    --> $DIR/matches.rs:156:18
249     |
250 156 |         Ok(3) => println!("ok"),
251     |                  ^^^^^^^^^^^^^^
252 note: consider refactoring into `Ok(3) | Ok(_)`
253    --> $DIR/matches.rs:156:18
254     |
255 156 |         Ok(3) => println!("ok"),
256     |                  ^^^^^^^^^^^^^^
257     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
258
259 error: this `match` has identical arm bodies
260    --> $DIR/matches.rs:163:18
261     |
262 163 |         Ok(_) => println!("ok"),
263     |                  ^^^^^^^^^^^^^^
264     |
265 note: same as this
266    --> $DIR/matches.rs:162:18
267     |
268 162 |         Ok(3) => println!("ok"),
269     |                  ^^^^^^^^^^^^^^
270 note: consider refactoring into `Ok(3) | Ok(_)`
271    --> $DIR/matches.rs:162:18
272     |
273 162 |         Ok(3) => println!("ok"),
274     |                  ^^^^^^^^^^^^^^
275     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
276
277 error: this `match` has identical arm bodies
278    --> $DIR/matches.rs:169:18
279     |
280 169 |         Ok(_) => println!("ok"),
281     |                  ^^^^^^^^^^^^^^
282     |
283 note: same as this
284    --> $DIR/matches.rs:168:18
285     |
286 168 |         Ok(3) => println!("ok"),
287     |                  ^^^^^^^^^^^^^^
288 note: consider refactoring into `Ok(3) | Ok(_)`
289    --> $DIR/matches.rs:168:18
290     |
291 168 |         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:190:29
297     |
298 190 |         (Ok(_), Some(x)) => println!("ok {}", x),
299     |                             ^^^^^^^^^^^^^^^^^^^^
300     |
301 note: same as this
302    --> $DIR/matches.rs:189:29
303     |
304 189 |         (Ok(x), Some(_)) => println!("ok {}", x),
305     |                             ^^^^^^^^^^^^^^^^^^^^
306 note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
307    --> $DIR/matches.rs:189:29
308     |
309 189 |         (Ok(x), Some(_)) => println!("ok {}", x),
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:205:18
315     |
316 205 |         Ok(_) => println!("ok"),
317     |                  ^^^^^^^^^^^^^^
318     |
319 note: same as this
320    --> $DIR/matches.rs:204:18
321     |
322 204 |         Ok(3) => println!("ok"),
323     |                  ^^^^^^^^^^^^^^
324 note: consider refactoring into `Ok(3) | Ok(_)`
325    --> $DIR/matches.rs:204:18
326     |
327 204 |         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: use as_ref() instead
332    --> $DIR/matches.rs:212:33
333     |
334 212 |       let borrowed: Option<&()> = match owned {
335     |  _________________________________^
336 213 | |         None => None,
337 214 | |         Some(ref v) => Some(v),
338 215 | |     };
339     | |_____^ help: try this: `owned.as_ref()`
340     |
341     = note: `-D match-as-ref` implied by `-D warnings`
342
343 error: use as_mut() instead
344    --> $DIR/matches.rs:218:39
345     |
346 218 |       let borrow_mut: Option<&mut ()> = match mut_owned {
347     |  _______________________________________^
348 219 | |         None => None,
349 220 | |         Some(ref mut v) => Some(v),
350 221 | |     };
351     | |_____^ help: try this: `mut_owned.as_mut()`
352
353 error: aborting due to 25 previous errors
354