Skip to content

Commit be4e415

Browse files
author
Michael Wright
committed
Add additional tests to unneeded_wildcard_pattern
1 parent d04bf15 commit be4e415

File tree

3 files changed

+41
-9
lines changed

3 files changed

+41
-9
lines changed

tests/ui/unneeded_wildcard_pattern.fixed

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ fn main() {
77

88
if let (0, ..) = t {};
99
if let (0, ..) = t {};
10+
if let (.., 0) = t {};
11+
if let (.., 0) = t {};
1012
if let (0, ..) = t {};
1113
if let (0, ..) = t {};
1214
if let (_, 0, ..) = t {};
@@ -26,6 +28,8 @@ fn main() {
2628

2729
if let S(0, ..) = s {};
2830
if let S(0, ..) = s {};
31+
if let S(.., 0) = s {};
32+
if let S(.., 0) = s {};
2933
if let S(0, ..) = s {};
3034
if let S(0, ..) = s {};
3135
if let S(_, 0, ..) = s {};

tests/ui/unneeded_wildcard_pattern.rs

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ fn main() {
77

88
if let (0, .., _) = t {};
99
if let (0, _, ..) = t {};
10+
if let (_, .., 0) = t {};
11+
if let (.., _, 0) = t {};
1012
if let (0, _, _, ..) = t {};
1113
if let (0, .., _, _) = t {};
1214
if let (_, 0, ..) = t {};
@@ -26,6 +28,8 @@ fn main() {
2628

2729
if let S(0, .., _) = s {};
2830
if let S(0, _, ..) = s {};
31+
if let S(_, .., 0) = s {};
32+
if let S(.., _, 0) = s {};
2933
if let S(0, _, _, ..) = s {};
3034
if let S(0, .., _, _) = s {};
3135
if let S(_, 0, ..) = s {};

tests/ui/unneeded_wildcard_pattern.stderr

+33-9
Original file line numberDiff line numberDiff line change
@@ -16,53 +16,77 @@ error: this pattern is unneeded as the `..` pattern can match that element
1616
LL | if let (0, _, ..) = t {};
1717
| ^^^ help: remove it
1818

19+
error: this pattern is unneeded as the `..` pattern can match that element
20+
--> $DIR/unneeded_wildcard_pattern.rs:10:13
21+
|
22+
LL | if let (_, .., 0) = t {};
23+
| ^^^ help: remove it
24+
25+
error: this pattern is unneeded as the `..` pattern can match that element
26+
--> $DIR/unneeded_wildcard_pattern.rs:11:15
27+
|
28+
LL | if let (.., _, 0) = t {};
29+
| ^^^ help: remove it
30+
1931
error: these patterns are unneeded as the `..` pattern can match those elements
20-
--> $DIR/unneeded_wildcard_pattern.rs:10:16
32+
--> $DIR/unneeded_wildcard_pattern.rs:12:16
2133
|
2234
LL | if let (0, _, _, ..) = t {};
2335
| ^^^^^^ help: remove them
2436

2537
error: these patterns are unneeded as the `..` pattern can match those elements
26-
--> $DIR/unneeded_wildcard_pattern.rs:11:18
38+
--> $DIR/unneeded_wildcard_pattern.rs:13:18
2739
|
2840
LL | if let (0, .., _, _) = t {};
2941
| ^^^^^^ help: remove them
3042

3143
error: these patterns are unneeded as the `..` pattern can match those elements
32-
--> $DIR/unneeded_wildcard_pattern.rs:20:22
44+
--> $DIR/unneeded_wildcard_pattern.rs:22:22
3345
|
3446
LL | if let (0, .., _, _,) = t {};
3547
| ^^^^^^ help: remove them
3648

3749
error: this pattern is unneeded as the `..` pattern can match that element
38-
--> $DIR/unneeded_wildcard_pattern.rs:27:19
50+
--> $DIR/unneeded_wildcard_pattern.rs:29:19
3951
|
4052
LL | if let S(0, .., _) = s {};
4153
| ^^^ help: remove it
4254

4355
error: this pattern is unneeded as the `..` pattern can match that element
44-
--> $DIR/unneeded_wildcard_pattern.rs:28:17
56+
--> $DIR/unneeded_wildcard_pattern.rs:30:17
4557
|
4658
LL | if let S(0, _, ..) = s {};
4759
| ^^^ help: remove it
4860

61+
error: this pattern is unneeded as the `..` pattern can match that element
62+
--> $DIR/unneeded_wildcard_pattern.rs:31:14
63+
|
64+
LL | if let S(_, .., 0) = s {};
65+
| ^^^ help: remove it
66+
67+
error: this pattern is unneeded as the `..` pattern can match that element
68+
--> $DIR/unneeded_wildcard_pattern.rs:32:16
69+
|
70+
LL | if let S(.., _, 0) = s {};
71+
| ^^^ help: remove it
72+
4973
error: these patterns are unneeded as the `..` pattern can match those elements
50-
--> $DIR/unneeded_wildcard_pattern.rs:29:17
74+
--> $DIR/unneeded_wildcard_pattern.rs:33:17
5175
|
5276
LL | if let S(0, _, _, ..) = s {};
5377
| ^^^^^^ help: remove them
5478

5579
error: these patterns are unneeded as the `..` pattern can match those elements
56-
--> $DIR/unneeded_wildcard_pattern.rs:30:19
80+
--> $DIR/unneeded_wildcard_pattern.rs:34:19
5781
|
5882
LL | if let S(0, .., _, _) = s {};
5983
| ^^^^^^ help: remove them
6084

6185
error: these patterns are unneeded as the `..` pattern can match those elements
62-
--> $DIR/unneeded_wildcard_pattern.rs:39:23
86+
--> $DIR/unneeded_wildcard_pattern.rs:43:23
6387
|
6488
LL | if let S(0, .., _, _,) = s {};
6589
| ^^^^^^ help: remove them
6690

67-
error: aborting due to 10 previous errors
91+
error: aborting due to 14 previous errors
6892

0 commit comments

Comments
 (0)