-
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
Tracking issue for Option::filter (feature option_filter
)
#45860
Comments
@dtolnay Could you add a task "decide on the name ( |
@LukasKalbertodt @dtolnay Updated. |
I think I find that the In contrast, |
…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?
As I mentioned in #45863 (comment), I have a question regarding the signature of this method: Wouldn't this method be more flexible if the My suggested change would differ from I understand that this method is essentially shorthand for |
+1 for
|
@nvzqz Do you have a specific use case in mind? Yes, the method would be more flexible with So without good use case in mind, I would keep the signature as is: I don't think anyone would expect a predicate of a method called |
About the name: please note that the RFC thread already contains quite a few arguments for and against certain names. I'll try to summarize the most important points here: The two competing names are
Comparing the two:
How this method is called in other languages: |
It looks like we're still in the bikeshedding phase here, so just leaving a note to say I found my way here after typing |
@LukasKalbertodt |
@bb010g Good point. However, I think I still tend to keep the closure as it is right now. A few reasons:
However, I'm not quite sure and don't have a very strong opinion on this decision. |
You'd probably want |
So I guess we keep this issue just for Then there's only the naming issue left. Here again, I don't have a strong opinion. I like both names a lot and would be happy either way. |
There are not very many There are a bunch of |
As it seems unlikely that more time will produce new arguments either way, I’d like to propose stabilizing this feature as it currently is in Nightly. @rfcbot fcp merge |
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period is now complete. |
…=withoutboats Stabilize `Option::filter`. Fixes rust-lang#45860
This is a tracking issue for
Option::filter
.Option::filter
to the standard library rfcs#2124Option::filter()
according to RFC 2124 #44996 (not merged)Option::filter()
according to RFC 2124 #45863Unresolved questions:
filter
vsand_if
vs …)The text was updated successfully, but these errors were encountered: