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
New lint ignored_unit_patterns
#11242
Conversation
r? @giraffate (rustbot has picked a reviewer for you, use r? to override) |
I think it would be better for the name to mention that it's about pattern matching. Maybe |
b754487
to
f9a6dfa
Compare
Name and PR updated |
@Centri3 Thanks for your review, I think all points have been addressed. |
LGTM, I'll wait until @giraffate reviews as well though I think this should be good to go. Thanks! |
Oh yeah btw, I think in the future we can extend this to other patterns, like so: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=55acf7c246efb174d34dfe0c4e177425, in a general pedantic lint for unnecessary wildcards. Though it's probably debatable on whether this is better in that case, it does prevent the type changing as well which may or may not be a good thing. |
I think in the future we can extend this to other patterns
Yeah, the first step could be to extend it to other singleton
types (such as been done for `()`).
|
Hmm, I'm wondering if I would like hear @Centri3's opinion. |
|
@bors r=Centri3,giraffate Thanks! |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This check also catches
|
|
Ok, I filed #11403 where this can be discussed, but feel free to close if all is good. |
This idea comes from #11238. I've put the lint in
pedantic
as it might trigger numerous positives (three in Clippy itself).changelog: [
ignored_unit_patterns
]: new lint