-
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
Fix needless_match false positive for if-let when the else block doesn't match to given expr #8700
Fix needless_match false positive for if-let when the else block doesn't match to given expr #8700
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @camsteffen (or someone else) soon. Please see the contribution instructions for more information. |
fbe3b2e
to
d2f9c61
Compare
r? @Alexendoo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @xFrednet
tests/ui/needless_match.rs
Outdated
|
||
// Don't trigger | ||
let _ = if let Some(a) = Some(1) { | ||
do_something(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though actually one small nit, the do_something
should go as this statement doesn't trigger the FP
do_something(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Alexendoo thank you! I fixed it
b3ef94b
to
fa19572
Compare
when the else block doesn't match to given expr
fa19572
to
b94e24e
Compare
This version looks good to me, I'm taking the previous approval from @Alexendoo also as an okay. Thank you very much for the contribution and quick update @youknowone. 👍 Also thank you to @Alexendoo for taking over the review! 🎉 @bors r+ |
📌 Commit b94e24e has been approved by |
Thank you for everyone. I am excited to make my first contribution to clippy, finally. I want to bring more patches in near future. |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
fix #8695
Please write a short comment explaining your change (or "none" for internal only changes)
changelog: Fixed
[`needless_match`]
false positive when else block expression differs.