Skip to content
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

Question on unwrap_or_default #37025

Closed
lukasstevens opened this issue Oct 7, 2016 · 5 comments
Closed

Question on unwrap_or_default #37025

lukasstevens opened this issue Oct 7, 2016 · 5 comments

Comments

@lukasstevens
Copy link

lukasstevens commented Oct 7, 2016

Just a short question: What is the reason that unwrap_or_default is implemented for Option, but not for Result?

@lukasstevens lukasstevens changed the title Question on unwrap_for_default Question on unwrap_or_default Oct 7, 2016
@apasel422
Copy link
Contributor

I'm not sure why the method was left off Result, but it can be written almost as succinctly with:

some_result.unwrap_or_else(Default::default)

@devonhollowood
Copy link
Contributor

Would you consider accepting a pull request which implements unwrap_or_default for Result, or would this need to go through the RFC process?

@leoyvens
Copy link
Contributor

It might not be a good thing to make unwrapping results more ergonomic.

@bluss
Copy link
Member

bluss commented Oct 19, 2016

@devonhollowood A guess: it sounds appropriate to be just a PR. The libs team will ask you to "escalate" it to an RFC only if it's needed.

@arthurprs
Copy link
Contributor

It'd be nice to address this papercut.

bors added a commit that referenced this issue Nov 1, 2016
…xcrichton

Add `unwrap_or_default` method to `Result`

Fixes #37025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants