]> git.lizzy.rs Git - rust.git/blob - tests/ui/match_expr_like_matches_macro.stderr
match_like_matches_macro: strip refs in suggestion
[rust.git] / tests / ui / match_expr_like_matches_macro.stderr
1 error: match expression looks like `matches!` macro
2   --> $DIR/match_expr_like_matches_macro.rs:10:14
3    |
4 LL |       let _y = match x {
5    |  ______________^
6 LL | |         Some(0) => true,
7 LL | |         _ => false,
8 LL | |     };
9    | |_____^ help: try this: `matches!(x, Some(0))`
10    |
11    = note: `-D clippy::match-like-matches-macro` implied by `-D warnings`
12
13 error: match expression looks like `matches!` macro
14   --> $DIR/match_expr_like_matches_macro.rs:16:14
15    |
16 LL |       let _w = match x {
17    |  ______________^
18 LL | |         Some(_) => true,
19 LL | |         _ => false,
20 LL | |     };
21    | |_____^ help: try this: `matches!(x, Some(_))`
22
23 error: redundant pattern matching, consider using `is_none()`
24   --> $DIR/match_expr_like_matches_macro.rs:22:14
25    |
26 LL |       let _z = match x {
27    |  ______________^
28 LL | |         Some(_) => false,
29 LL | |         None => true,
30 LL | |     };
31    | |_____^ help: try this: `x.is_none()`
32    |
33    = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
34
35 error: match expression looks like `matches!` macro
36   --> $DIR/match_expr_like_matches_macro.rs:28:15
37    |
38 LL |       let _zz = match x {
39    |  _______________^
40 LL | |         Some(r) if r == 0 => false,
41 LL | |         _ => true,
42 LL | |     };
43    | |_____^ help: try this: `!matches!(x, Some(r) if r == 0)`
44
45 error: if let .. else expression looks like `matches!` macro
46   --> $DIR/match_expr_like_matches_macro.rs:34:16
47    |
48 LL |     let _zzz = if let Some(5) = x { true } else { false };
49    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `matches!(x, Some(5))`
50
51 error: match expression looks like `matches!` macro
52   --> $DIR/match_expr_like_matches_macro.rs:58:20
53    |
54 LL |           let _ans = match x {
55    |  ____________________^
56 LL | |             E::A(_) => true,
57 LL | |             E::B(_) => true,
58 LL | |             _ => false,
59 LL | |         };
60    | |_________^ help: try this: `matches!(x, E::A(_) | E::B(_))`
61
62 error: match expression looks like `matches!` macro
63   --> $DIR/match_expr_like_matches_macro.rs:66:20
64    |
65 LL |           let _ans = match x {
66    |  ____________________^
67 LL | |             E::B(_) => false,
68 LL | |             E::C => false,
69 LL | |             _ => true,
70 LL | |         };
71    | |_________^ help: try this: `!matches!(x, E::B(_) | E::C)`
72
73 error: match expression looks like `matches!` macro
74   --> $DIR/match_expr_like_matches_macro.rs:126:18
75    |
76 LL |           let _z = match &z {
77    |  __________________^
78 LL | |             Some(3) => true,
79 LL | |             _ => false,
80 LL | |         };
81    | |_________^ help: try this: `matches!(z, Some(3))`
82
83 error: match expression looks like `matches!` macro
84   --> $DIR/match_expr_like_matches_macro.rs:135:18
85    |
86 LL |           let _z = match &z {
87    |  __________________^
88 LL | |             Some(3) => true,
89 LL | |             _ => false,
90 LL | |         };
91    | |_________^ help: try this: `matches!(&z, Some(3))`
92
93 error: match expression looks like `matches!` macro
94   --> $DIR/match_expr_like_matches_macro.rs:152:21
95    |
96 LL |               let _ = match &z {
97    |  _____________________^
98 LL | |                 AnEnum::X => true,
99 LL | |                 _ => false,
100 LL | |             };
101    | |_____________^ help: try this: `matches!(&z, AnEnum::X)`
102
103 error: match expression looks like `matches!` macro
104   --> $DIR/match_expr_like_matches_macro.rs:166:20
105    |
106 LL |           let _res = match &val {
107    |  ____________________^
108 LL | |             &Some(ref _a) => true,
109 LL | |             _ => false,
110 LL | |         };
111    | |_________^ help: try this: `matches!(&val, &Some(ref _a))`
112
113 error: you don't need to add `&` to both the expression and the patterns
114   --> $DIR/match_expr_like_matches_macro.rs:166:20
115    |
116 LL |           let _res = match &val {
117    |  ____________________^
118 LL | |             &Some(ref _a) => true,
119 LL | |             _ => false,
120 LL | |         };
121    | |_________^
122    |
123    = note: `-D clippy::match-ref-pats` implied by `-D warnings`
124 help: try
125    |
126 LL |         let _res = match val {
127 LL |             Some(ref _a) => true,
128    |
129
130 error: match expression looks like `matches!` macro
131   --> $DIR/match_expr_like_matches_macro.rs:178:20
132    |
133 LL |           let _res = match &val {
134    |  ____________________^
135 LL | |             &Some(ref _a) => true,
136 LL | |             _ => false,
137 LL | |         };
138    | |_________^ help: try this: `matches!(&val, &Some(ref _a))`
139
140 error: you don't need to add `&` to both the expression and the patterns
141   --> $DIR/match_expr_like_matches_macro.rs:178:20
142    |
143 LL |           let _res = match &val {
144    |  ____________________^
145 LL | |             &Some(ref _a) => true,
146 LL | |             _ => false,
147 LL | |         };
148    | |_________^
149    |
150 help: try
151    |
152 LL |         let _res = match val {
153 LL |             Some(ref _a) => true,
154    |
155
156 error: aborting due to 14 previous errors
157