-
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
Inaccuracy in the documentation for Option::unwrap_or_default #100054
Labels
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
Comments
moenie99
added
the
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
label
Aug 2, 2022
The documentation seems alright? Yes, |
I think there could be for people like this (no offensive) type annotations. |
The example could be simplified indeed. |
@rustbot claim |
fee1-dead
added a commit
to fee1-dead-contrib/rust
that referenced
this issue
Sep 25, 2022
Type-annotate and simplify documentation of Option::unwrap_or_default Part of rust-lang#100054
notriddle
added a commit
to notriddle/rust
that referenced
this issue
Sep 26, 2022
…-unwrap-or-default, r=thomcc Improve code example for Option::unwrap_or_default Fixes rust-lang#100054. Follow-up of rust-lang#102259. r? `@thomcc`
notriddle
added a commit
to notriddle/rust
that referenced
this issue
Sep 26, 2022
…-unwrap-or-default, r=thomcc Improve code example for Option::unwrap_or_default Fixes rust-lang#100054. Follow-up of rust-lang#102259. r? ``@thomcc``
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
Location
https://doc.rust-lang.org/std/option/enum.Option.html#method.unwrap_or_default
Summary
It appears that the example was wrongly adapted from Result::unwrap_or_default, however the example does not work here because parse will never return None, its returns a Result. It appears that ideally a more fitting example should be written.
The text was updated successfully, but these errors were encountered: