Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should ignored-unit-patterns include parameter destructuring #11403

Closed
cloneable opened this issue Aug 25, 2023 · 5 comments · Fixed by #11454
Closed

Should ignored-unit-patterns include parameter destructuring #11403

cloneable opened this issue Aug 25, 2023 · 5 comments · Fixed by #11454
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@cloneable
Copy link

cloneable commented Aug 25, 2023

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

@cloneable cloneable added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Aug 25, 2023
@Alexendoo
Copy link
Member

Yeah I think this would be good to ignore

@Centri3
Copy link
Member

Centri3 commented Aug 26, 2023

This also extends to let statements, where type annotations are present: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=edc8b6319b4a6ad1374ee18c17125b2a

@cloneable
Copy link
Author

Would it be best to move this check to clippy::nursery (before next beta) until things are sorted? I do believe it should be part of clippy::pedantic in the future, at least personally I'd like to see it there, but it seems this check needs more work.

@samueltardieu
Copy link
Contributor

@rustbot claim

@cloneable
Copy link
Author

Sorry, I noticed that beta.5 went out without this fix. Was this the last beta before the release? Does this mean this lint gets included in pedantic in the unfixed state in 1.73?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants