-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add Option::filter()
according to RFC 2124
#45863
Conversation
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.
I appreciate the "Questions for code reviewers"! Everything looks good to me.
@rust-lang/libs this is adding an unstable fn filter<P>(self, predicate: P) -> Self
where
P: FnOnce(&T) -> bool |
@bors r+ |
📌 Commit e652144 has been approved by |
…r=dtolnay Add `Option::filter()` according to RFC 2124 (*old PR: rust-lang#44996) This is the implementation of [RFC "Add `Option::filter` to the standard library"](rust-lang/rfcs#2124). Tracking issue: rust-lang#45860 **Questions for code reviewers:** - Is the documentation sufficiently long? - Is the documentation easy enough to understand? - Is the position of the new method (after `and_then()`) a good one?
I haven't been following the discussion on this closely but wouldn't this method be more flexible if the Then again, this method acts similarly to |
@nvzqz please mention concerns or suggestions like this in the tracking issue to have all discussion in one place. Thanks :) |
(old PR: #44996)
This is the implementation of RFC "Add
Option::filter
to the standard library". Tracking issue: #45860Questions for code reviewers:
and_then()
) a good one?