summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/match_ref_pats.stderr
blob: 7d9646c842ee85bc2c34e2d7e97d680a4f65ade0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
error: you don't need to add `&` to all patterns
  --> $DIR/match_ref_pats.rs:9:9
   |
LL | /         match v {
LL | |             &Some(v) => println!("{:?}", v),
LL | |             &None => println!("none"),
LL | |         }
   | |_________^
   |
   = note: `-D clippy::match-ref-pats` implied by `-D warnings`
help: instead of prefixing all patterns with `&`, you can dereference the expression
   |
LL ~         match *v {
LL ~             Some(v) => println!("{:?}", v),
LL ~             None => println!("none"),
   |

error: you don't need to add `&` to both the expression and the patterns
  --> $DIR/match_ref_pats.rs:26:5
   |
LL | /     match &w {
LL | |         &Some(v) => println!("{:?}", v),
LL | |         &None => println!("none"),
LL | |     }
   | |_____^
   |
help: try
   |
LL ~     match w {
LL ~         Some(v) => println!("{:?}", v),
LL ~         None => println!("none"),
   |

error: redundant pattern matching, consider using `is_none()`
  --> $DIR/match_ref_pats.rs:38:12
   |
LL |     if let &None = a {
   |     -------^^^^^---- help: try this: `if a.is_none()`
   |
   = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`

error: redundant pattern matching, consider using `is_none()`
  --> $DIR/match_ref_pats.rs:43:12
   |
LL |     if let &None = &b {
   |     -------^^^^^----- help: try this: `if b.is_none()`

error: you don't need to add `&` to all patterns
  --> $DIR/match_ref_pats.rs:103:9
   |
LL | /         match foobar_variant!(0) {
LL | |             &FooBar::Foo => println!("Foo"),
LL | |             &FooBar::Bar => println!("Bar"),
LL | |             &FooBar::FooBar => println!("FooBar"),
LL | |             _ => println!("Wild"),
LL | |         }
   | |_________^
   |
help: instead of prefixing all patterns with `&`, you can dereference the expression
   |
LL ~         match *foobar_variant!(0) {
LL ~             FooBar::Foo => println!("Foo"),
LL ~             FooBar::Bar => println!("Bar"),
LL ~             FooBar::FooBar => println!("FooBar"),
   |

error: aborting due to 5 previous errors