Skip to content

Should ignored-unit-patterns include parameter destructuring #11403

@cloneable

Description

@cloneable

Summary

error: matching over () is more explicit
--> src/lib.rs:8:12
|
8 | pub fn moo(_: ()) {}
| ^ help: use () instead of _: ()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
= note: -D clippy::ignored-unit-patterns implied by -D clippy::pedantic

Lint Name

ignored_unit_patterns

Reproducer

I tried this code:

pub fn moo(_: ()) {}

I saw this happen:

error: matching over `()` is more explicit --> src/lib.rs:1:12 | 8 | pub fn moo(_: ()) {} | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns = note: `-D clippy::ignored-unit-patterns` implied by `-D clippy::pedantic` 

I expected to see this happen:

It's unclear from #11242 and the test cases if this check was intended to include parameter destructuring.

Version

rustc 1.73.0-beta.1 (680cdf816 2023-08-21) binary: rustc commit-hash: 680cdf8168a906b4ea80af673c64e4a16f77be57 commit-date: 2023-08-21 host: aarch64-apple-darwin release: 1.73.0-beta.1 LLVM version: 17.0.0 

Additional Labels

No response

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions