-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
clippy::match_ref_pats probably shouldn't fire for if let #7740
Comments
For that matter, we should probably not lint |
So, would we be suggesting that for a single If so, are there any tests around this and what's the part of the code that I should be looking at for this? |
Thank you for the pointers! rust-clippy/clippy_lints/src/matches.rs Line 1185 in 78e7312
where we iterate through the patterns and count the number of occurrences of |
It looks like you could just modify |
Hey, thank you so much for the pointers. are we able to add this to hacktoberfest? |
I think any PR will count? |
Can I pick up this issue? @camsteffen |
Yes just comment with |
@rustbot claim |
Lint name:
I tried this code:
I expected to see this happen: warning free
Instead, this happened:
clippy::match_ref_pats
matchedThe point of
clippy::match_ref_pats
is that it's less notation to put a single deref on the matched value than a ref on every pattern, but withif let
this doesn't apply, as there's only one pattern to begin with.Either the description/help message should change when only one pattern is present, or
clippy::match_ref_pats
should only be emitted when more than one pattern are present.Meta
Rust version (
rustc -Vv
):The text was updated successfully, but these errors were encountered: