-
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
Do not suggest replacing simple if let Some(_) / None
with methods
#2353
Comments
Advantages of
Disadvantages of
I don't have a strong opinion either way. I just do what clippy says We could make it a restriction lint, but then I'd also like to see the opposite lint. Side note: - if let None = node_weight {
+ if node_weight.is_none() {
return None;
} shouldn't that simply be |
I'd like to see a lint for that. :) |
Please suggest replacing I think that using collections is fundamental to Rust. This method is general, works with any collection and is just as easy to understand as the alternative. I prefer general over Option-specific methods. |
No trolling, please. |
Given that this hasn't received any "me too"s, I think people are generally satisfied with the current behavior. To me |
This lint I don't quite agree with, and I realize opinions will differ on this.
Lint link: https://rust-lang-nursery.github.io/rust-clippy/v0.0.177/index.html#if_let_redundant_pattern_matching
Existing code in removed (red) and the proposed change by clippy in added (green) lines:
etc with similar examples.
I think that using
if let
is fundamental to Rust, is general, works with any enum and is just as easy to understand as the alternative. I prefer general over Option-specific methods.The text was updated successfully, but these errors were encountered: