book icon indicating copy to clipboard operation
book copied to clipboard

Ch13-01 Incorrect function name

Open USER-5 opened this issue 3 years ago • 0 comments

  • [x] I have checked the latest main branch to see if this has already been fixed

  • [x] I have searched existing issues and pull requests for duplicates

URL to the section(s) of the book with this problem:

https://doc.rust-lang.org/book/ch13-01-closures.html#capturing-the-environment-with-closures

Description of the problem:

The text says:

The method shirt_giveaway defined on Inventory

While the listing referenced (13-1) says:

impl Inventory {
    fn giveaway(&self, user_preference: Option<ShirtColor>) -> ShirtColor {
        user_preference.unwrap_or_else(|| self.most_stocked())
    }

    fn most_stocked(&self) -> ShirtColor {
        // snip
    }
}

Suggested fix:

Update the text description to be

The method giveaway defined on Inventory

The method name in the listing is more appropriate in my opinion

USER-5 avatar Jul 21 '22 23:07 USER-5