Skip to content

[Ch08-03: Hash maps] Description of program doesn't match the actual code #3251

@awulkan

Description

@awulkan
  • I have checked the latest main branch to see if this has already been fixed
  • I have searched existing issues and pull requests for duplicates

URL to the section(s) of the book with this problem:
https://github.com/rust-lang/book/blob/main/src/ch08-03-hash-maps.md?plain=1#L60
https://github.com/rust-lang/book/blob/main/listings/ch08-common-collections/listing-08-21/src/main.rs

Description of the problem:

I'm new to Rust so maybe I'm misunderstanding something, but the book says this about listing 8-21:

"This program handles the Option by calling unwrap_or to set score to zero if scores doesn't have an entry for the key."

Yet the code listing that it's referring to doesn't use unwrap_or.

Suggested fix:
Either implement what the text says, or remove the text.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions