as I mentioned in my translation issue, I have mostly completed a translation of the Rust Book into Persian (Chapters 0 to 16) and still working on the complete chapters. While a previous translation exists, it only covers the first three or four chapters and remains incomplete.
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
In Listing 14-7 of Chapter 14, the `use add_one;` statement is redundant
and can be removed. Before the Rust 2018 edition, this statement was
required to bring the `add_one` crate into scope, so it likely got
missed during refactorings from that transition.
By removing this line, the code becomes more concise and reflects the
current best practices for using external crates in Rust.
Issue #4186
---------
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
- Merge in changes from `main`, including moving the chapter.
- Merge in newly-written introduction of `let-else` in the same section
as the `if let` discussion.
- Rewrap lines.
This is not technically part of the 2024 Edition, since it is available
on the 2021 edition as well, but it *will* be an important update for
the 2024 Edition revision of the print book!
* Matching Named Variables: mention `if let`/`while let`
`if let` and `while let` introduce new scope for named variables just like `match`. However, they do not support match guards yet, see RFC 2497.
* Ch. 19: further clarify discussion of `if|while let` patterns
- While keeping the note about `if let` and `while let` when introducing
the discussion of matching named variables, bring the phrasing back
closer to the original.
- Move the distinction that `if let` and `while let` do not have the
equivalent of match guards down to the discussion of match guards.
- Line wrapping.
---------
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
The existing text here has a long historical record; it predates `impl`
or `dyn` existing at all, much less the version we landed on in Rust
2018. Update it to suggest defaulting to `impl Fn`, with trait objects
`Box<dyn Fn>` the fallback.
Fixes#1514Fixes#3272