]>
Commit | Line | Data |
---|---|---|
f20569fa | 1 | error: you don't need to add `&` to all patterns |
923072b8 | 2 | --> $DIR/match_ref_pats.rs:8:9 |
f20569fa XL |
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 | | | |
94222f64 XL |
13 | LL ~ match *v { |
14 | LL ~ Some(v) => println!("{:?}", v), | |
15 | LL ~ None => println!("none"), | |
f20569fa XL |
16 | | |
17 | ||
f20569fa | 18 | error: you don't need to add `&` to both the expression and the patterns |
923072b8 | 19 | --> $DIR/match_ref_pats.rs:25:5 |
f20569fa XL |
20 | | |
21 | LL | / match &w { | |
22 | LL | | &Some(v) => println!("{:?}", v), | |
23 | LL | | &None => println!("none"), | |
24 | LL | | } | |
25 | | |_____^ | |
26 | | | |
27 | help: try | |
28 | | | |
94222f64 XL |
29 | LL ~ match w { |
30 | LL ~ Some(v) => println!("{:?}", v), | |
31 | LL ~ None => println!("none"), | |
f20569fa XL |
32 | | |
33 | ||
cdc7bbd5 | 34 | error: redundant pattern matching, consider using `is_none()` |
923072b8 | 35 | --> $DIR/match_ref_pats.rs:37:12 |
cdc7bbd5 XL |
36 | | |
37 | LL | if let &None = a { | |
38 | | -------^^^^^---- help: try this: `if a.is_none()` | |
39 | | | |
40 | = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` | |
41 | ||
cdc7bbd5 | 42 | error: redundant pattern matching, consider using `is_none()` |
923072b8 | 43 | --> $DIR/match_ref_pats.rs:42:12 |
cdc7bbd5 XL |
44 | | |
45 | LL | if let &None = &b { | |
46 | | -------^^^^^----- help: try this: `if b.is_none()` | |
47 | ||
f20569fa | 48 | error: you don't need to add `&` to all patterns |
923072b8 | 49 | --> $DIR/match_ref_pats.rs:102:9 |
f20569fa | 50 | | |
3c0e092e XL |
51 | LL | / match foobar_variant!(0) { |
52 | LL | | &FooBar::Foo => println!("Foo"), | |
53 | LL | | &FooBar::Bar => println!("Bar"), | |
54 | LL | | &FooBar::FooBar => println!("FooBar"), | |
f20569fa XL |
55 | LL | | _ => println!("Wild"), |
56 | LL | | } | |
57 | | |_________^ | |
58 | | | |
59 | help: instead of prefixing all patterns with `&`, you can dereference the expression | |
60 | | | |
3c0e092e XL |
61 | LL ~ match *foobar_variant!(0) { |
62 | LL ~ FooBar::Foo => println!("Foo"), | |
63 | LL ~ FooBar::Bar => println!("Bar"), | |
64 | LL ~ FooBar::FooBar => println!("FooBar"), | |
f20569fa XL |
65 | | |
66 | ||
3c0e092e | 67 | error: aborting due to 5 previous errors |
f20569fa | 68 |