]> git.lizzy.rs Git - rust.git/blob - tests/ui/matches.stderr
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / matches.stderr
1 error: you don't need to add `&` to all patterns
2   --> $DIR/matches.rs:20:9
3    |
4 LL | /         match v {
5 LL | |             &Some(v) => println!("{:?}", v),
6 LL | |             &None => println!("none"),
7 LL | |         }
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 LL |         match *v {
14 LL |             Some(v) => println!("{:?}", v),
15 LL |             None => println!("none"),
16    |
17
18 error: you don't need to add `&` to all patterns
19   --> $DIR/matches.rs:31:5
20    |
21 LL | /     match tup {
22 LL | |         &(v, 1) => println!("{}", v),
23 LL | |         _ => println!("none"),
24 LL | |     }
25    | |_____^
26 help: instead of prefixing all patterns with `&`, you can dereference the expression
27    |
28 LL |     match *tup {
29 LL |         (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:37:5
34    |
35 LL | /     match &w {
36 LL | |         &Some(v) => println!("{:?}", v),
37 LL | |         &None => println!("none"),
38 LL | |     }
39    | |_____^
40 help: try
41    |
42 LL |     match w {
43 LL |         Some(v) => println!("{:?}", v),
44 LL |         None => println!("none"),
45    |
46
47 error: you don't need to add `&` to all patterns
48   --> $DIR/matches.rs:48:5
49    |
50 LL | /     if let &None = a {
51 LL | |         println!("none");
52 LL | |     }
53    | |_____^
54 help: instead of prefixing all patterns with `&`, you can dereference the expression
55    |
56 LL |     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:53:5
61    |
62 LL | /     if let &None = &b {
63 LL | |         println!("none");
64 LL | |     }
65    | |_____^
66 help: try
67    |
68 LL |     if let None = b {
69    |            ^^^^   ^
70
71 error: Err(_) will match all errors, maybe not a good idea
72   --> $DIR/matches.rs:64:9
73    |
74 LL |         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:63:18
82    |
83 LL |         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:62:18
89    |
90 LL |         Ok(3) => println!("ok"),
91    |                  ^^^^^^^^^^^^^^
92 note: consider refactoring into `Ok(3) | Ok(_)`
93   --> $DIR/matches.rs:62:18
94    |
95 LL |         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:70:9
101    |
102 LL |         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:69:18
109    |
110 LL |         Ok(_) => println!("ok"),
111    |                  ^^^^^^^^^^^^^^
112    |
113 note: same as this
114   --> $DIR/matches.rs:68:18
115    |
116 LL |         Ok(3) => println!("ok"),
117    |                  ^^^^^^^^^^^^^^
118 note: consider refactoring into `Ok(3) | Ok(_)`
119   --> $DIR/matches.rs:68:18
120    |
121 LL |         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:76:9
127    |
128 LL |         Err(_) => {
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:75:18
135    |
136 LL |         Ok(_) => println!("ok"),
137    |                  ^^^^^^^^^^^^^^
138    |
139 note: same as this
140   --> $DIR/matches.rs:74:18
141    |
142 LL |         Ok(3) => println!("ok"),
143    |                  ^^^^^^^^^^^^^^
144 note: consider refactoring into `Ok(3) | Ok(_)`
145   --> $DIR/matches.rs:74:18
146    |
147 LL |         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:84:18
153    |
154 LL |         Ok(_) => println!("ok"),
155    |                  ^^^^^^^^^^^^^^
156    |
157 note: same as this
158   --> $DIR/matches.rs:83:18
159    |
160 LL |         Ok(3) => println!("ok"),
161    |                  ^^^^^^^^^^^^^^
162 note: consider refactoring into `Ok(3) | Ok(_)`
163   --> $DIR/matches.rs:83:18
164    |
165 LL |         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:91:18
171    |
172 LL |         Ok(_) => println!("ok"),
173    |                  ^^^^^^^^^^^^^^
174    |
175 note: same as this
176   --> $DIR/matches.rs:90:18
177    |
178 LL |         Ok(3) => println!("ok"),
179    |                  ^^^^^^^^^^^^^^
180 note: consider refactoring into `Ok(3) | Ok(_)`
181   --> $DIR/matches.rs:90:18
182    |
183 LL |         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:97:18
189    |
190 LL |         Ok(_) => println!("ok"),
191    |                  ^^^^^^^^^^^^^^
192    |
193 note: same as this
194   --> $DIR/matches.rs:96:18
195    |
196 LL |         Ok(3) => println!("ok"),
197    |                  ^^^^^^^^^^^^^^
198 note: consider refactoring into `Ok(3) | Ok(_)`
199   --> $DIR/matches.rs:96:18
200    |
201 LL |         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:103:18
207    |
208 LL |         Ok(_) => println!("ok"),
209    |                  ^^^^^^^^^^^^^^
210    |
211 note: same as this
212   --> $DIR/matches.rs:102:18
213    |
214 LL |         Ok(3) => println!("ok"),
215    |                  ^^^^^^^^^^^^^^
216 note: consider refactoring into `Ok(3) | Ok(_)`
217   --> $DIR/matches.rs:102:18
218    |
219 LL |         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:126:29
225    |
226 LL |         (Ok(_), Some(x)) => println!("ok {}", x),
227    |                             ^^^^^^^^^^^^^^^^^^^^
228    |
229 note: same as this
230   --> $DIR/matches.rs:125:29
231    |
232 LL |         (Ok(x), Some(_)) => println!("ok {}", x),
233    |                             ^^^^^^^^^^^^^^^^^^^^
234 note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
235   --> $DIR/matches.rs:125:29
236    |
237 LL |         (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:141:18
243    |
244 LL |         Ok(_) => println!("ok"),
245    |                  ^^^^^^^^^^^^^^
246    |
247 note: same as this
248   --> $DIR/matches.rs:140:18
249    |
250 LL |         Ok(3) => println!("ok"),
251    |                  ^^^^^^^^^^^^^^
252 note: consider refactoring into `Ok(3) | Ok(_)`
253   --> $DIR/matches.rs:140:18
254    |
255 LL |         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:150:33
261    |
262 LL |       let borrowed: Option<&()> = match owned {
263    |  _________________________________^
264 LL | |         None => None,
265 LL | |         Some(ref v) => Some(v),
266 LL | |     };
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:156:39
273    |
274 LL |       let borrow_mut: Option<&mut ()> = match mut_owned {
275    |  _______________________________________^
276 LL | |         None => None,
277 LL | |         Some(ref mut v) => Some(v),
278 LL | |     };
279    | |_____^ help: try this: `mut_owned.as_mut()`
280
281 error: aborting due to 19 previous errors
282