Add Option::is_none_or#100602
Conversation
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @thomcc (or someone else) soon. Please see the contribution instructions for more information. |
|
Hi, this is a new unstable API, so you need to file an ACP for this. See the bots message for the process. Thanks. |
There was a problem hiding this comment.
| #[unstable(feature = "is_some_with", issue = "93050")] | |
| #[unstable(feature = "option_is_none_or", issue = "none")] |
For now. But you can wait for the ACP to be resolved.
|
r? @m-ou-se |
|
Ah, I didn't see the message about the tracking issue (or perhaps you edited it). I guess this possibly can skip ACP? No strong feelings from me either way. |
|
I'm guessing it would be part of the |
|
I should also mention that, based on a rudimentary Godbolt test, this new method seems to optimize nicely. |
|
Can we have I ran into a case the other day where I wanted to write: .filter(|r| r.is_err_or(|value| value.something()))
.collect::<Result<_, _>(); |
I think this case might be sufficiently covered by |
|
Thanks for your PR. I'm closing this as we decided not to add this method to Option. See rust-lang/libs-team#212. |
This is my first contribution to Rust, so I welcome any churn no matter how pedantic. :)
This was discussed on this tracking issue.