]> git.lizzy.rs Git - rust.git/blob - tests/ui/match_ref_pats.stderr
Improved shared_code_in_if_blocks message and added test stderrs
[rust.git] / tests / ui / match_ref_pats.stderr
1 error: you don't need to add `&` to all patterns
2   --> $DIR/match_ref_pats.rs:6: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/match_ref_pats.rs:17:5
20    |
21 LL | /     match tup {
22 LL | |         &(v, 1) => println!("{}", v),
23 LL | |         _ => println!("none"),
24 LL | |     }
25    | |_____^
26    |
27 help: instead of prefixing all patterns with `&`, you can dereference the expression
28    |
29 LL |     match *tup {
30 LL |         (v, 1) => println!("{}", v),
31    |
32
33 error: you don't need to add `&` to both the expression and the patterns
34   --> $DIR/match_ref_pats.rs:23:5
35    |
36 LL | /     match &w {
37 LL | |         &Some(v) => println!("{:?}", v),
38 LL | |         &None => println!("none"),
39 LL | |     }
40    | |_____^
41    |
42 help: try
43    |
44 LL |     match w {
45 LL |         Some(v) => println!("{:?}", v),
46 LL |         None => println!("none"),
47    |
48
49 error: redundant pattern matching, consider using `is_none()`
50   --> $DIR/match_ref_pats.rs:35:12
51    |
52 LL |     if let &None = a {
53    |     -------^^^^^---- help: try this: `if a.is_none()`
54    |
55    = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
56
57 error: you don't need to add `&` to all patterns
58   --> $DIR/match_ref_pats.rs:35:5
59    |
60 LL | /     if let &None = a {
61 LL | |         println!("none");
62 LL | |     }
63    | |_____^
64    |
65 help: instead of prefixing all patterns with `&`, you can dereference the expression
66    |
67 LL |     if let None = *a {
68    |            ^^^^   ^^
69
70 error: redundant pattern matching, consider using `is_none()`
71   --> $DIR/match_ref_pats.rs:40:12
72    |
73 LL |     if let &None = &b {
74    |     -------^^^^^----- help: try this: `if b.is_none()`
75
76 error: you don't need to add `&` to both the expression and the patterns
77   --> $DIR/match_ref_pats.rs:40:5
78    |
79 LL | /     if let &None = &b {
80 LL | |         println!("none");
81 LL | |     }
82    | |_____^
83    |
84 help: try
85    |
86 LL |     if let None = b {
87    |            ^^^^   ^
88
89 error: you don't need to add `&` to all patterns
90   --> $DIR/match_ref_pats.rs:67:9
91    |
92 LL | /         match foo_variant!(0) {
93 LL | |             &Foo::A => println!("A"),
94 LL | |             _ => println!("Wild"),
95 LL | |         }
96    | |_________^
97    |
98 help: instead of prefixing all patterns with `&`, you can dereference the expression
99    |
100 LL |         match *foo_variant!(0) {
101 LL |             Foo::A => println!("A"),
102    |
103
104 error: aborting due to 8 previous errors
105