Refactor Option::filter method#45933
Conversation
src/libcore/option.rs
Outdated
There was a problem hiding this comment.
Nitpicking: ; is unnecessary here.
There was a problem hiding this comment.
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.