Skip to content

Inaccuracy in the documentation for Option::unwrap_or_default #100054

Closed

Description

@moenie99

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.

Activity

  1. added
    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools
    on Aug 2, 2022
  2. ArtifyCZ commented on Aug 5, 2022

    @ArtifyCZ

    I think there could be for people like this (no offensive) type annotations.

  3. GuillaumeGomez commented on Sep 25, 2022

    @GuillaumeGomez
    Member

    The example could be simplified indeed.

  4. added a commit that references this issue on Sep 25, 2022
  5. added 2 commits that reference this issue on Sep 26, 2022
    e096298
    2668a68
  6. added a commit that references this issue on Sep 26, 2022
    f3a6fbf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions