]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/src/docs/unneeded_wildcard_pattern.txt
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / src / docs / unneeded_wildcard_pattern.txt
CommitLineData
f2b60f7d
FG
1### What it does
2Checks for tuple patterns with a wildcard
3pattern (`_`) is next to a rest pattern (`..`).
4
5_NOTE_: While `_, ..` means there is at least one element left, `..`
6means there are 0 or more elements left. This can make a difference
7when refactoring, but shouldn't result in errors in the refactored code,
8since the wildcard pattern isn't used anyway.
9
10### Why is this bad?
11The wildcard pattern is unneeded as the rest pattern
12can match that element as well.
13
14### Example
15```
16match t {
17 TupleStruct(0, .., _) => (),
18 _ => (),
19}
20```
21
22Use instead:
23```
24match t {
25 TupleStruct(0, ..) => (),
26 _ => (),
27}
28```