cognitive-engineering-lab / rust-book

The Rust Programming Language: Experimental Edition
https://rust-book.cs.brown.edu
Other
504 stars 82 forks source link

`Context` for Quiz `Question 3` in Section 2 of Chapter 13 has a typo #100

Closed hamirmahal closed 1 year ago

hamirmahal commented 1 year ago

URL to the section(s) of the book with this problem: https://rust-book.cs.brown.edu/ch13-02-iterators.html#using-closures-that-capture-their-environment

Description of the problem: The Context for Question 3 has typo.

Therefore the closure in map takes &i32 as input. The multiplication operator is implemented for &i32, so x does not need to be dereferences in x 2.

Suggested fix: Change the above sentence like so.

Therefore the closure in map takes &i32 as input. The multiplication operator is implemented for &i32, so x does not need to be dereferenced in x 2.

hamirmahal commented 1 year ago

image