1 error: you don't need to add `&` to all patterns
2 --> $DIR/matches.rs:11:9
5 LL | | &Some(v) => println!("{:?}", v),
6 LL | | &None => println!("none"),
10 = note: `-D clippy::match-ref-pats` implied by `-D warnings`
11 help: instead of prefixing all patterns with `&`, you can dereference the expression
14 LL | Some(v) => println!("{:?}", v),
15 LL | None => println!("none"),
18 error: you don't need to add `&` to all patterns
19 --> $DIR/matches.rs:22:5
22 LL | | &(v, 1) => println!("{}", v),
23 LL | | _ => println!("none"),
26 help: instead of prefixing all patterns with `&`, you can dereference the expression
29 LL | (v, 1) => println!("{}", v),
32 error: you don't need to add `&` to both the expression and the patterns
33 --> $DIR/matches.rs:28:5
36 LL | | &Some(v) => println!("{:?}", v),
37 LL | | &None => println!("none"),
43 LL | Some(v) => println!("{:?}", v),
44 LL | None => println!("none"),
47 error: you don't need to add `&` to all patterns
48 --> $DIR/matches.rs:39:5
50 LL | / if let &None = a {
51 LL | | println!("none");
54 help: instead of prefixing all patterns with `&`, you can dereference the expression
56 LL | if let None = *a {
59 error: you don't need to add `&` to both the expression and the patterns
60 --> $DIR/matches.rs:44:5
62 LL | / if let &None = &b {
63 LL | | println!("none");
68 LL | if let None = b {
71 error: Err(_) will match all errors, maybe not a good idea
72 --> $DIR/matches.rs:55:9
74 LL | Err(_) => panic!("err"),
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
80 error: this `match` has identical arm bodies
81 --> $DIR/matches.rs:54:18
83 LL | Ok(_) => println!("ok"),
86 = note: `-D clippy::match-same-arms` implied by `-D warnings`
88 --> $DIR/matches.rs:53:18
90 LL | Ok(3) => println!("ok"),
92 note: consider refactoring into `Ok(3) | Ok(_)`
93 --> $DIR/matches.rs:53:18
95 LL | Ok(3) => println!("ok"),
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)
99 error: Err(_) will match all errors, maybe not a good idea
100 --> $DIR/matches.rs:61:9
102 LL | Err(_) => panic!(),
105 = note: to remove this warning, match each error separately or use unreachable macro
107 error: this `match` has identical arm bodies
108 --> $DIR/matches.rs:60:18
110 LL | Ok(_) => println!("ok"),
114 --> $DIR/matches.rs:59:18
116 LL | Ok(3) => println!("ok"),
118 note: consider refactoring into `Ok(3) | Ok(_)`
119 --> $DIR/matches.rs:59:18
121 LL | Ok(3) => println!("ok"),
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)
125 error: Err(_) will match all errors, maybe not a good idea
126 --> $DIR/matches.rs:67:9
131 = note: to remove this warning, match each error separately or use unreachable macro
133 error: this `match` has identical arm bodies
134 --> $DIR/matches.rs:66:18
136 LL | Ok(_) => println!("ok"),
140 --> $DIR/matches.rs:65:18
142 LL | Ok(3) => println!("ok"),
144 note: consider refactoring into `Ok(3) | Ok(_)`
145 --> $DIR/matches.rs:65:18
147 LL | Ok(3) => println!("ok"),
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)
151 error: this `match` has identical arm bodies
152 --> $DIR/matches.rs:75:18
154 LL | Ok(_) => println!("ok"),
158 --> $DIR/matches.rs:74:18
160 LL | Ok(3) => println!("ok"),
162 note: consider refactoring into `Ok(3) | Ok(_)`
163 --> $DIR/matches.rs:74:18
165 LL | Ok(3) => println!("ok"),
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)
169 error: this `match` has identical arm bodies
170 --> $DIR/matches.rs:82:18
172 LL | Ok(_) => println!("ok"),
176 --> $DIR/matches.rs:81:18
178 LL | Ok(3) => println!("ok"),
180 note: consider refactoring into `Ok(3) | Ok(_)`
181 --> $DIR/matches.rs:81:18
183 LL | Ok(3) => println!("ok"),
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)
187 error: this `match` has identical arm bodies
188 --> $DIR/matches.rs:88:18
190 LL | Ok(_) => println!("ok"),
194 --> $DIR/matches.rs:87:18
196 LL | Ok(3) => println!("ok"),
198 note: consider refactoring into `Ok(3) | Ok(_)`
199 --> $DIR/matches.rs:87:18
201 LL | Ok(3) => println!("ok"),
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)
205 error: this `match` has identical arm bodies
206 --> $DIR/matches.rs:94:18
208 LL | Ok(_) => println!("ok"),
212 --> $DIR/matches.rs:93:18
214 LL | Ok(3) => println!("ok"),
216 note: consider refactoring into `Ok(3) | Ok(_)`
217 --> $DIR/matches.rs:93:18
219 LL | Ok(3) => println!("ok"),
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)
223 error: this `match` has identical arm bodies
224 --> $DIR/matches.rs:117:29
226 LL | (Ok(_), Some(x)) => println!("ok {}", x),
227 | ^^^^^^^^^^^^^^^^^^^^
230 --> $DIR/matches.rs:116:29
232 LL | (Ok(x), Some(_)) => println!("ok {}", x),
233 | ^^^^^^^^^^^^^^^^^^^^
234 note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
235 --> $DIR/matches.rs:116:29
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)
241 error: this `match` has identical arm bodies
242 --> $DIR/matches.rs:132:18
244 LL | Ok(_) => println!("ok"),
248 --> $DIR/matches.rs:131:18
250 LL | Ok(3) => println!("ok"),
252 note: consider refactoring into `Ok(3) | Ok(_)`
253 --> $DIR/matches.rs:131:18
255 LL | Ok(3) => println!("ok"),
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)
259 error: use as_ref() instead
260 --> $DIR/matches.rs:141:33
262 LL | let borrowed: Option<&()> = match owned {
263 | _________________________________^
265 LL | | Some(ref v) => Some(v),
267 | |_____^ help: try this: `owned.as_ref()`
269 = note: `-D clippy::match-as-ref` implied by `-D warnings`
271 error: use as_mut() instead
272 --> $DIR/matches.rs:147:39
274 LL | let borrow_mut: Option<&mut ()> = match mut_owned {
275 | _______________________________________^
277 LL | | Some(ref mut v) => Some(v),
279 | |_____^ help: try this: `mut_owned.as_mut()`
281 error: you don't need to add `&` to all patterns
282 --> $DIR/matches.rs:174:5
284 LL | / match foo_variant!(0) {
285 LL | | &Foo::A => println!("A"),
286 LL | | _ => println!("Wild"),
289 help: instead of prefixing all patterns with `&`, you can dereference the expression
291 LL | match *foo_variant!(0) {
292 LL | Foo::A => println!("A"),
295 error: aborting due to 20 previous errors