-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Refactor Option::filter method #45933
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
Conversation
src/libcore/option.rs
Outdated
} | ||
None => None, | ||
} | ||
}; |
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.
Nitpicking: ;
is unnecessary here.
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.
Yeah, Updated. Thanks
2419d80
to
abff092
Compare
@bors: r+ |
📌 Commit abff092 has been approved by |
…crichton Refactor Option::filter method
What was the reason for this change? I don't really care that my code was changed, I just don't really understand why. I guess it's because it has fewer lines and only one |
@LukasKalbertodt I surmise it was just mildly more idiomatic to use |
Why not this so ? match self {
Some(x) if predicate(&x) => Some(x),
_ => None
} |
@Kerollmops That would be cetainly better, but currently impossible (produces an error E0008). |
Ho ! you're right ! sorry ! I hope the NLL will change this kind of error. |
No description provided.