]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/match_same_arms2.stderr
Auto merge of #95274 - jendrikw:slice-must-use, r=Dylan-DPC
[rust.git] / src / tools / clippy / tests / ui / match_same_arms2.stderr
1 error: this match arm has an identical body to the `_` wildcard arm
2   --> $DIR/match_same_arms2.rs:11:9
3    |
4 LL | /         42 => {
5 LL | |             foo();
6 LL | |             let mut a = 42 + [23].len() as i32;
7 LL | |             if true {
8 ...  |
9 LL | |             a
10 LL | |         },
11    | |_________^ help: try removing the arm
12    |
13    = note: `-D clippy::match-same-arms` implied by `-D warnings`
14    = help: or try changing either arm body
15 note: `_` wildcard arm here
16   --> $DIR/match_same_arms2.rs:20:9
17    |
18 LL | /         _ => {
19 LL | |             //~ ERROR match arms have same body
20 LL | |             foo();
21 LL | |             let mut a = 42 + [23].len() as i32;
22 ...  |
23 LL | |             a
24 LL | |         },
25    | |_________^
26
27 error: this match arm has an identical body to another arm
28   --> $DIR/match_same_arms2.rs:34:9
29    |
30 LL |         51 => foo(), //~ ERROR match arms have same body
31    |         --^^^^^^^^^
32    |         |
33    |         help: try merging the arm patterns: `51 | 42`
34    |
35    = help: or try changing either arm body
36 note: other arm here
37   --> $DIR/match_same_arms2.rs:33:9
38    |
39 LL |         42 => foo(),
40    |         ^^^^^^^^^^^
41
42 error: this match arm has an identical body to another arm
43   --> $DIR/match_same_arms2.rs:40:9
44    |
45 LL |         None => 24, //~ ERROR match arms have same body
46    |         ----^^^^^^
47    |         |
48    |         help: try merging the arm patterns: `None | Some(_)`
49    |
50    = help: or try changing either arm body
51 note: other arm here
52   --> $DIR/match_same_arms2.rs:39:9
53    |
54 LL |         Some(_) => 24,
55    |         ^^^^^^^^^^^^^
56
57 error: this match arm has an identical body to another arm
58   --> $DIR/match_same_arms2.rs:62:9
59    |
60 LL |         (None, Some(a)) => bar(a), //~ ERROR match arms have same body
61    |         ---------------^^^^^^^^^^
62    |         |
63    |         help: try merging the arm patterns: `(None, Some(a)) | (Some(a), None)`
64    |
65    = help: or try changing either arm body
66 note: other arm here
67   --> $DIR/match_same_arms2.rs:61:9
68    |
69 LL |         (Some(a), None) => bar(a),
70    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
71
72 error: this match arm has an identical body to another arm
73   --> $DIR/match_same_arms2.rs:67:9
74    |
75 LL |         (Some(a), ..) => bar(a),
76    |         -------------^^^^^^^^^^
77    |         |
78    |         help: try merging the arm patterns: `(Some(a), ..) | (.., Some(a))`
79    |
80    = help: or try changing either arm body
81 note: other arm here
82   --> $DIR/match_same_arms2.rs:68:9
83    |
84 LL |         (.., Some(a)) => bar(a), //~ ERROR match arms have same body
85    |         ^^^^^^^^^^^^^^^^^^^^^^^
86
87 error: this match arm has an identical body to another arm
88   --> $DIR/match_same_arms2.rs:101:9
89    |
90 LL |         (Ok(x), Some(_)) => println!("ok {}", x),
91    |         ----------------^^^^^^^^^^^^^^^^^^^^^^^^
92    |         |
93    |         help: try merging the arm patterns: `(Ok(x), Some(_)) | (Ok(_), Some(x))`
94    |
95    = help: or try changing either arm body
96 note: other arm here
97   --> $DIR/match_same_arms2.rs:102:9
98    |
99 LL |         (Ok(_), Some(x)) => println!("ok {}", x),
100    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101
102 error: this match arm has an identical body to another arm
103   --> $DIR/match_same_arms2.rs:117:9
104    |
105 LL |         Ok(_) => println!("ok"),
106    |         -----^^^^^^^^^^^^^^^^^^
107    |         |
108    |         help: try merging the arm patterns: `Ok(_) | Ok(3)`
109    |
110    = help: or try changing either arm body
111 note: other arm here
112   --> $DIR/match_same_arms2.rs:116:9
113    |
114 LL |         Ok(3) => println!("ok"),
115    |         ^^^^^^^^^^^^^^^^^^^^^^^
116
117 error: this match arm has an identical body to another arm
118   --> $DIR/match_same_arms2.rs:144:9
119    |
120 LL |           1 => {
121    |           ^ help: try merging the arm patterns: `1 | 0`
122    |  _________|
123    | |
124 LL | |             empty!(0);
125 LL | |         },
126    | |_________^
127    |
128    = help: or try changing either arm body
129 note: other arm here
130   --> $DIR/match_same_arms2.rs:141:9
131    |
132 LL | /         0 => {
133 LL | |             empty!(0);
134 LL | |         },
135    | |_________^
136
137 error: match expression looks like `matches!` macro
138   --> $DIR/match_same_arms2.rs:162:16
139    |
140 LL |       let _ans = match x {
141    |  ________________^
142 LL | |         E::A => false,
143 LL | |         E::B => false,
144 LL | |         _ => true,
145 LL | |     };
146    | |_____^ help: try this: `!matches!(x, E::A | E::B)`
147    |
148    = note: `-D clippy::match-like-matches-macro` implied by `-D warnings`
149
150 error: this match arm has an identical body to another arm
151   --> $DIR/match_same_arms2.rs:194:9
152    |
153 LL |         Foo::X(0) => 1,
154    |         ---------^^^^^
155    |         |
156    |         help: try merging the arm patterns: `Foo::X(0) | Foo::Z(_)`
157    |
158    = help: or try changing either arm body
159 note: other arm here
160   --> $DIR/match_same_arms2.rs:196:9
161    |
162 LL |         Foo::Z(_) => 1,
163    |         ^^^^^^^^^^^^^^
164
165 error: this match arm has an identical body to another arm
166   --> $DIR/match_same_arms2.rs:204:9
167    |
168 LL |         Foo::Z(_) => 1,
169    |         ---------^^^^^
170    |         |
171    |         help: try merging the arm patterns: `Foo::Z(_) | Foo::X(0)`
172    |
173    = help: or try changing either arm body
174 note: other arm here
175   --> $DIR/match_same_arms2.rs:202:9
176    |
177 LL |         Foo::X(0) => 1,
178    |         ^^^^^^^^^^^^^^
179
180 error: this match arm has an identical body to another arm
181   --> $DIR/match_same_arms2.rs:227:9
182    |
183 LL |         Some(Bar { y: 0, x: 5, .. }) => 1,
184    |         ----------------------------^^^^^
185    |         |
186    |         help: try merging the arm patterns: `Some(Bar { y: 0, x: 5, .. }) | Some(Bar { x: 0, y: 5, .. })`
187    |
188    = help: or try changing either arm body
189 note: other arm here
190   --> $DIR/match_same_arms2.rs:224:9
191    |
192 LL |         Some(Bar { x: 0, y: 5, .. }) => 1,
193    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
194
195 error: aborting due to 12 previous errors
196