diff --git a/listings/ch19-patterns-and-matching/listing-19-10/output.txt b/listings/ch19-patterns-and-matching/listing-19-10/output.txt index 7f825dc..1c890d5 100644 --- a/listings/ch19-patterns-and-matching/listing-19-10/output.txt +++ b/listings/ch19-patterns-and-matching/listing-19-10/output.txt @@ -1,13 +1,13 @@ $ cargo run Compiling patterns v0.1.0 (file:///projects/patterns) -warning: irrefutable `let...else` pattern - --> src/main.rs:2:5 +warning: irrefutable `if let` pattern + --> src/main.rs:2:8 | -2 | let x = 5 else { - | ^^^^^^^^^ +2 | if let x = 5 { + | ^^^^^^^^^ | - = note: this pattern will always match, so the `else` clause is useless - = help: consider removing the `else` clause + = note: this pattern will always match, so the `if let` is useless + = help: consider replacing the `if let` with a `let` = note: `#[warn(irrefutable_let_patterns)]` on by default warning: `patterns` (bin "patterns") generated 1 warning diff --git a/listings/ch19-patterns-and-matching/listing-19-10/src/main.rs b/listings/ch19-patterns-and-matching/listing-19-10/src/main.rs index 5d1cc5c..2073948 100644 --- a/listings/ch19-patterns-and-matching/listing-19-10/src/main.rs +++ b/listings/ch19-patterns-and-matching/listing-19-10/src/main.rs @@ -1,7 +1,7 @@ fn main() { // ANCHOR: here - if let x = 5 else { - return; + if let x = 5 { + println!("{x}"); }; // ANCHOR_END: here }