blob: 817061efd1622bd388d649ec41f3faeb8154c87a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
### What it does
Checks for tuple patterns with a wildcard
pattern (`_`) is next to a rest pattern (`..`).
_NOTE_: While `_, ..` means there is at least one element left, `..`
means there are 0 or more elements left. This can make a difference
when refactoring, but shouldn't result in errors in the refactored code,
since the wildcard pattern isn't used anyway.
### Why is this bad?
The wildcard pattern is unneeded as the rest pattern
can match that element as well.
### Example
```
match t {
TupleStruct(0, .., _) => (),
_ => (),
}
```
Use instead:
```
match t {
TupleStruct(0, ..) => (),
_ => (),
}
```
|