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