cognitive-engineering-lab / rust-book

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

Quiz in 18.1 uses `..` remaining parts ignore syntax before it's explained #14

Closed bhamiltoncx closed 1 year ago

bhamiltoncx commented 1 year ago

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

https://github.com/cognitive-engineering-lab/rust-book/blob/1537ac115e08f2945e98c6a6664f0b4bfdbc75e4/src/ch18-01-all-the-places-for-patterns.md?plain=1#L205

Description of the problem:

Section 18.1 on pattern matching mentions that .. could be used to ignore values:

To fix the error, we could ignore one or more of the values in the tuple using _ or .., as you’ll see in the “Ignoring Values in a Pattern” section. If the problem is that we have too many variables in the pattern, the solution is to make the types match by removing variables so the number of variables equals the number of elements in the tuple.

and the quiz at the end of the section quizzes you on the .. match-ignoring syntax:

https://github.com/cognitive-engineering-lab/rust-book/blob/1537ac115e08f2945e98c6a6664f0b4bfdbc75e4/quizzes/ch18-01-all-the-places-for-patterns.toml#L16

but the .. syntax is not explained until section 18.3:

https://github.com/cognitive-engineering-lab/rust-book/blob/1537ac115e08f2945e98c6a6664f0b4bfdbc75e4/src/ch18-03-pattern-syntax.md?plain=1#L387

Suggested fix:

Move the quiz on .. to after section 18.3, or move the explanation of .. into section 18.1.

willcrichton commented 1 year ago

Thanks, this has been fixed.