Skip to content

ch19-01: fix outdated claim that if let conditions can't be combined (let chains) - #4803

Open
peterlodri-sec wants to merge 1 commit into
rust-lang:mainfrom
peterlodri-sec:fix-ch19-let-chains-4612
Open

ch19-01: fix outdated claim that if let conditions can't be combined (let chains)#4803
peterlodri-sec wants to merge 1 commit into
rust-lang:mainfrom
peterlodri-sec:fix-ch19-let-chains-4612

Conversation

@peterlodri-sec

Copy link
Copy Markdown

Fixes #4612.

Chapter 19-01 ("Conditional if let Expressions") currently tells readers we can't write if let Ok(age) = age && age > 30. But let chains stabilized in Rust 1.88, and this book targets the 2024 edition (edition = "2024", toolchain 1.97) — where that combination is valid: the binding introduced by if let is in scope for the conditions that follow it in the chain. I verified the outdated text is still present on main, and the playground test in the issue confirms it compiles on stable.

This is a minimal wording fix: it keeps the nested example (which still usefully demonstrates mixing if let / else if / else if let) and replaces only the incorrect "we can't combine" sentence with an accurate note about let chains. Happy to adjust the framing if you'd prefer a different treatment. 🦀

…9-01)

let chains stabilized in Rust 1.88; the book targets edition 2024, where
`if let Ok(age) = age && age > 30` is valid. Fixes rust-lang#4612.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Untrue (presumably outdated) information about if let

1 participant