Skip to content

Typos in "The Guessing Game" #31284

@theroseknight

Description

@theroseknight

Brand new to Rust so I apologize if this is not the right place for something like this. I just finished "The Guessing Game" and noticed a small typo:

We can do that with three more lines. Here’s our new program:

The new three lines:

    let guess: u32 = guess.trim().parse()
        .expect("Please type a number!");

It appears the book was updated at some point to only contain two lines.

Similarly. in the following section. this could be a typo or possibly just confusing:

io::stdin().read_line(&mut guess).expect("failed to read line"); 

If we leave off calling these two methods, our program will compile, but we’ll get a warning:

The two methods could refer to .expect and panic!.

Activity

steveklabnik

steveklabnik commented on Jan 29, 2016

@steveklabnik
Member

Nope, this is a typo. There used to be calls to ok() in there, and they were removed, but the English wasn't.

added a commit that references this issue on Jan 29, 2016
24c928b
added a commit that references this issue on Jan 30, 2016
ee7670e
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @steveklabnik@theroseknight

        Issue actions

          Typos in "The Guessing Game" · Issue #31284 · rust-lang/rust