-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 Result<Result<T, E>, E>::flatten -> Result<T, E> #70140
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@@ -1214,6 +1214,38 @@ impl<T, E> Result<Option<T>, E> { | |||
} | |||
} | |||
|
|||
impl<T, E> Result<Result<T, E>, E> { | |||
/// Converts from `Result<Result<T, E>, E>` to `Result<T, E>` |
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 think the documentation could be reworded a bit, to emphasize what happens if one of the results is an Err
variant (which wasn't really needed for Option<T>::flatten
). It should be noted that, in Rustdoc, you don't directly see the type of self
when looking at the definition of a method.
Should this possibly also convert the error type like the try operator does? |
r? @Amanieu |
It seems strange to me that an operation named |
@bors r+ rollup |
📌 Commit 6fe7867 has been approved by |
Rollup of 3 pull requests Successful merges: - rust-lang#70140 (Add Result<Result<T, E>, E>::flatten -> Result<T, E>) - rust-lang#70526 (reduce `rustc_attr` usage in places) - rust-lang#70527 (Update LLVM submodule) Failed merges: r? @ghost
This PR makes this possible (modulo type inference):
Tracking issue: #70142
largely cribbed directly from #60256