fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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