Skip to content

Commit

Permalink
Add additional tests to unneeded_wildcard_pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Wright committed Sep 22, 2019
1 parent d04bf15 commit be4e415
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
4 changes: 4 additions & 0 deletions tests/ui/unneeded_wildcard_pattern.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ fn main() {

if let (0, ..) = t {};
if let (0, ..) = t {};
if let (.., 0) = t {};
if let (.., 0) = t {};
if let (0, ..) = t {};
if let (0, ..) = t {};
if let (_, 0, ..) = t {};
Expand All @@ -26,6 +28,8 @@ fn main() {

if let S(0, ..) = s {};
if let S(0, ..) = s {};
if let S(.., 0) = s {};
if let S(.., 0) = s {};
if let S(0, ..) = s {};
if let S(0, ..) = s {};
if let S(_, 0, ..) = s {};
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/unneeded_wildcard_pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ fn main() {

if let (0, .., _) = t {};
if let (0, _, ..) = t {};
if let (_, .., 0) = t {};
if let (.., _, 0) = t {};
if let (0, _, _, ..) = t {};
if let (0, .., _, _) = t {};
if let (_, 0, ..) = t {};
Expand All @@ -26,6 +28,8 @@ fn main() {

if let S(0, .., _) = s {};
if let S(0, _, ..) = s {};
if let S(_, .., 0) = s {};
if let S(.., _, 0) = s {};
if let S(0, _, _, ..) = s {};
if let S(0, .., _, _) = s {};
if let S(_, 0, ..) = s {};
Expand Down
42 changes: 33 additions & 9 deletions tests/ui/unneeded_wildcard_pattern.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,53 +16,77 @@ error: this pattern is unneeded as the `..` pattern can match that element
LL | if let (0, _, ..) = t {};
| ^^^ help: remove it

error: this pattern is unneeded as the `..` pattern can match that element
--> $DIR/unneeded_wildcard_pattern.rs:10:13
|
LL | if let (_, .., 0) = t {};
| ^^^ help: remove it

error: this pattern is unneeded as the `..` pattern can match that element
--> $DIR/unneeded_wildcard_pattern.rs:11:15
|
LL | if let (.., _, 0) = t {};
| ^^^ help: remove it

error: these patterns are unneeded as the `..` pattern can match those elements
--> $DIR/unneeded_wildcard_pattern.rs:10:16
--> $DIR/unneeded_wildcard_pattern.rs:12:16
|
LL | if let (0, _, _, ..) = t {};
| ^^^^^^ help: remove them

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

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

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

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

error: this pattern is unneeded as the `..` pattern can match that element
--> $DIR/unneeded_wildcard_pattern.rs:31:14
|
LL | if let S(_, .., 0) = s {};
| ^^^ help: remove it

error: this pattern is unneeded as the `..` pattern can match that element
--> $DIR/unneeded_wildcard_pattern.rs:32:16
|
LL | if let S(.., _, 0) = s {};
| ^^^ help: remove it

error: these patterns are unneeded as the `..` pattern can match those elements
--> $DIR/unneeded_wildcard_pattern.rs:29:17
--> $DIR/unneeded_wildcard_pattern.rs:33:17
|
LL | if let S(0, _, _, ..) = s {};
| ^^^^^^ help: remove them

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

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

error: aborting due to 10 previous errors
error: aborting due to 14 previous errors

0 comments on commit be4e415

Please sign in to comment.