- Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
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 thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have