Skip to content

Commit 564bfe2

Browse files
committed
allow stacked_if_match in other tests
1 parent c805345 commit 564bfe2

10 files changed

+261
-60
lines changed

tests/ui/match_single_binding.fixed

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
clippy::no_effect,
66
clippy::toplevel_ref_arg,
77
clippy::uninlined_format_args,
8-
clippy::useless_vec
8+
clippy::useless_vec,
9+
clippy::stacked_if_match
910
)]
1011

1112
struct Point {

tests/ui/match_single_binding.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
clippy::no_effect,
66
clippy::toplevel_ref_arg,
77
clippy::uninlined_format_args,
8-
clippy::useless_vec
8+
clippy::useless_vec,
9+
clippy::stacked_if_match
910
)]
1011

1112
struct Point {

tests/ui/match_single_binding.stderr

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: this match could be written as a `let` statement
2-
--> tests/ui/match_single_binding.rs:33:5
2+
--> tests/ui/match_single_binding.rs:34:5
33
|
44
LL | / match (a, b, c) {
55
LL | | (x, y, z) => {
@@ -19,7 +19,7 @@ LL + }
1919
|
2020

2121
error: this match could be written as a `let` statement
22-
--> tests/ui/match_single_binding.rs:39:5
22+
--> tests/ui/match_single_binding.rs:40:5
2323
|
2424
LL | / match (a, b, c) {
2525
LL | | (x, y, z) => println!("{} {} {}", x, y, z),
@@ -33,15 +33,15 @@ LL + println!("{} {} {}", x, y, z);
3333
|
3434

3535
error: this match could be replaced by its body itself
36-
--> tests/ui/match_single_binding.rs:56:5
36+
--> tests/ui/match_single_binding.rs:57:5
3737
|
3838
LL | / match a {
3939
LL | | _ => println!("whatever"),
4040
LL | | }
4141
| |_____^ help: consider using the match body instead: `println!("whatever");`
4242

4343
error: this match could be replaced by its body itself
44-
--> tests/ui/match_single_binding.rs:60:5
44+
--> tests/ui/match_single_binding.rs:61:5
4545
|
4646
LL | / match a {
4747
LL | | _ => {
@@ -60,7 +60,7 @@ LL + }
6060
|
6161

6262
error: this match could be replaced by its body itself
63-
--> tests/ui/match_single_binding.rs:67:5
63+
--> tests/ui/match_single_binding.rs:68:5
6464
|
6565
LL | / match a {
6666
LL | | _ => {
@@ -82,7 +82,7 @@ LL + }
8282
|
8383

8484
error: this match could be written as a `let` statement
85-
--> tests/ui/match_single_binding.rs:77:5
85+
--> tests/ui/match_single_binding.rs:78:5
8686
|
8787
LL | / match p {
8888
LL | | Point { x, y } => println!("Coords: ({}, {})", x, y),
@@ -96,7 +96,7 @@ LL + println!("Coords: ({}, {})", x, y);
9696
|
9797

9898
error: this match could be written as a `let` statement
99-
--> tests/ui/match_single_binding.rs:81:5
99+
--> tests/ui/match_single_binding.rs:82:5
100100
|
101101
LL | / match p {
102102
LL | | Point { x: x1, y: y1 } => println!("Coords: ({}, {})", x1, y1),
@@ -110,7 +110,7 @@ LL + println!("Coords: ({}, {})", x1, y1);
110110
|
111111

112112
error: this match could be written as a `let` statement
113-
--> tests/ui/match_single_binding.rs:86:5
113+
--> tests/ui/match_single_binding.rs:87:5
114114
|
115115
LL | / match x {
116116
LL | | ref r => println!("Got a reference to {}", r),
@@ -124,7 +124,7 @@ LL + println!("Got a reference to {}", r);
124124
|
125125

126126
error: this match could be written as a `let` statement
127-
--> tests/ui/match_single_binding.rs:91:5
127+
--> tests/ui/match_single_binding.rs:92:5
128128
|
129129
LL | / match x {
130130
LL | | ref mut mr => println!("Got a mutable reference to {}", mr),
@@ -138,7 +138,7 @@ LL + println!("Got a mutable reference to {}", mr);
138138
|
139139

140140
error: this match could be written as a `let` statement
141-
--> tests/ui/match_single_binding.rs:95:5
141+
--> tests/ui/match_single_binding.rs:96:5
142142
|
143143
LL | / let product = match coords() {
144144
LL | | Point { x, y } => x * y,
@@ -152,7 +152,7 @@ LL + let product = x * y;
152152
|
153153

154154
error: this match could be written as a `let` statement
155-
--> tests/ui/match_single_binding.rs:103:18
155+
--> tests/ui/match_single_binding.rs:104:18
156156
|
157157
LL | .map(|i| match i.unwrap() {
158158
| __________________^
@@ -169,7 +169,7 @@ LL ~ })
169169
|
170170

171171
error: this match could be replaced by its body itself
172-
--> tests/ui/match_single_binding.rs:129:5
172+
--> tests/ui/match_single_binding.rs:130:5
173173
|
174174
LL | / match x {
175175
LL | | // =>
@@ -178,7 +178,7 @@ LL | | }
178178
| |_____^ help: consider using the match body instead: `println!("Not an array index start")`
179179

180180
error: this assignment could be simplified
181-
--> tests/ui/match_single_binding.rs:138:5
181+
--> tests/ui/match_single_binding.rs:139:5
182182
|
183183
LL | / val = match val.split_at(idx) {
184184
LL | | (pre, suf) => {
@@ -198,7 +198,7 @@ LL ~ };
198198
|
199199

200200
error: this match could be replaced by its scrutinee and body
201-
--> tests/ui/match_single_binding.rs:151:16
201+
--> tests/ui/match_single_binding.rs:152:16
202202
|
203203
LL | let _ = || match side_effects() {
204204
| ________________^
@@ -215,7 +215,7 @@ LL ~ };
215215
|
216216

217217
error: this match could be written as a `let` statement
218-
--> tests/ui/match_single_binding.rs:157:5
218+
--> tests/ui/match_single_binding.rs:158:5
219219
|
220220
LL | / match r {
221221
LL | | x => match x {
@@ -240,15 +240,15 @@ LL ~ };
240240
|
241241

242242
error: this match could be replaced by its body itself
243-
--> tests/ui/match_single_binding.rs:170:5
243+
--> tests/ui/match_single_binding.rs:171:5
244244
|
245245
LL | / match 1 {
246246
LL | | _ => (),
247247
LL | | }
248248
| |_____^ help: consider using the match body instead: `();`
249249

250250
error: this match could be replaced by its body itself
251-
--> tests/ui/match_single_binding.rs:174:13
251+
--> tests/ui/match_single_binding.rs:175:13
252252
|
253253
LL | let a = match 1 {
254254
| _____________^
@@ -257,15 +257,15 @@ LL | | };
257257
| |_____^ help: consider using the match body instead: `()`
258258

259259
error: this match could be replaced by its body itself
260-
--> tests/ui/match_single_binding.rs:178:5
260+
--> tests/ui/match_single_binding.rs:179:5
261261
|
262262
LL | / match 1 {
263263
LL | | _ => side_effects(),
264264
LL | | }
265265
| |_____^ help: consider using the match body instead: `side_effects();`
266266

267267
error: this match could be replaced by its body itself
268-
--> tests/ui/match_single_binding.rs:182:13
268+
--> tests/ui/match_single_binding.rs:183:13
269269
|
270270
LL | let b = match 1 {
271271
| _____________^
@@ -274,15 +274,15 @@ LL | | };
274274
| |_____^ help: consider using the match body instead: `side_effects()`
275275

276276
error: this match could be replaced by its body itself
277-
--> tests/ui/match_single_binding.rs:186:5
277+
--> tests/ui/match_single_binding.rs:187:5
278278
|
279279
LL | / match 1 {
280280
LL | | _ => println!("1"),
281281
LL | | }
282282
| |_____^ help: consider using the match body instead: `println!("1");`
283283

284284
error: this match could be replaced by its body itself
285-
--> tests/ui/match_single_binding.rs:190:13
285+
--> tests/ui/match_single_binding.rs:191:13
286286
|
287287
LL | let c = match 1 {
288288
| _____________^
@@ -291,23 +291,23 @@ LL | | };
291291
| |_____^ help: consider using the match body instead: `println!("1")`
292292

293293
error: this match could be replaced by its body itself
294-
--> tests/ui/match_single_binding.rs:195:9
294+
--> tests/ui/match_single_binding.rs:196:9
295295
|
296296
LL | / match 1 {
297297
LL | | _ => (),
298298
LL | | },
299299
| |_________^ help: consider using the match body instead: `()`
300300

301301
error: this match could be replaced by its body itself
302-
--> tests/ui/match_single_binding.rs:198:9
302+
--> tests/ui/match_single_binding.rs:199:9
303303
|
304304
LL | / match 1 {
305305
LL | | _ => side_effects(),
306306
LL | | },
307307
| |_________^ help: consider using the match body instead: `side_effects()`
308308

309309
error: this match could be replaced by its body itself
310-
--> tests/ui/match_single_binding.rs:201:9
310+
--> tests/ui/match_single_binding.rs:202:9
311311
|
312312
LL | / match 1 {
313313
LL | | _ => println!("1"),

tests/ui/match_single_binding2.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![warn(clippy::match_single_binding)]
22
#![allow(unused_variables)]
33
#![allow(clippy::uninlined_format_args)]
4+
#![allow(clippy::stacked_if_match)]
45

56
fn main() {
67
// Lint (additional curly braces needed, see #6572)

tests/ui/match_single_binding2.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![warn(clippy::match_single_binding)]
22
#![allow(unused_variables)]
33
#![allow(clippy::uninlined_format_args)]
4+
#![allow(clippy::stacked_if_match)]
45

56
fn main() {
67
// Lint (additional curly braces needed, see #6572)

tests/ui/match_single_binding2.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: this match could be written as a `let` statement
2-
--> tests/ui/match_single_binding2.rs:17:36
2+
--> tests/ui/match_single_binding2.rs:18:36
33
|
44
LL | Some((iter, _item)) => match iter.size_hint() {
55
| ____________________________________^
@@ -18,7 +18,7 @@ LL ~ },
1818
|
1919

2020
error: this match could be written as a `let` statement
21-
--> tests/ui/match_single_binding2.rs:30:13
21+
--> tests/ui/match_single_binding2.rs:31:13
2222
|
2323
LL | / match get_tup() {
2424
LL | | (a, b) => println!("a {:?} and b {:?}", a, b),
@@ -32,7 +32,7 @@ LL + println!("a {:?} and b {:?}", a, b)
3232
|
3333

3434
error: this match could be replaced by its scrutinee and body
35-
--> tests/ui/match_single_binding2.rs:41:5
35+
--> tests/ui/match_single_binding2.rs:42:5
3636
|
3737
LL | / match side_effects() {
3838
LL | | _ => println!("Side effects"),
@@ -46,7 +46,7 @@ LL + println!("Side effects");
4646
|
4747

4848
error: this match could be replaced by its scrutinee and body
49-
--> tests/ui/match_single_binding2.rs:48:5
49+
--> tests/ui/match_single_binding2.rs:49:5
5050
|
5151
LL | / match match x {
5252
LL | | 0 => 1,

tests/ui/significant_drop_in_scrutinee.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
//@no-rustfix
33
#![warn(clippy::significant_drop_in_scrutinee)]
44
#![allow(dead_code, unused_assignments)]
5-
#![allow(clippy::match_single_binding, clippy::single_match, clippy::uninlined_format_args)]
5+
#![allow(
6+
clippy::match_single_binding,
7+
clippy::single_match,
8+
clippy::uninlined_format_args,
9+
clippy::stacked_if_match
10+
)]
611

712
use std::num::ParseIntError;
813
use std::ops::Deref;

0 commit comments

Comments
 (0)