diff options
| author | mejrs <> | 2022-12-23 22:23:37 +0100 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2023-01-11 14:40:07 -0800 |
| commit | 8476c517c08c21d770a80d4bf0fea28834ae45f0 (patch) | |
| tree | dba7dc75bf459d24716351c6158e84730f6686ff /tests/ui/error-codes | |
| parent | 31c20210b9683f983953e1a4e45db94146b3c7cb (diff) | |
| download | rust-8476c517c08c21d770a80d4bf0fea28834ae45f0.tar.gz rust-8476c517c08c21d770a80d4bf0fea28834ae45f0.zip | |
Don't recommend `if let` if `let else` works
Diffstat (limited to 'tests/ui/error-codes')
| -rw-r--r-- | tests/ui/error-codes/E0005.stderr | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/tests/ui/error-codes/E0005.stderr b/tests/ui/error-codes/E0005.stderr index 3c27a7d4c06..4692b66413d 100644 --- a/tests/ui/error-codes/E0005.stderr +++ b/tests/ui/error-codes/E0005.stderr @@ -7,11 +7,7 @@ LL | let Some(y) = x; = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `Option<i32>` -help: you might want to use `if let` to ignore the variant that isn't matched - | -LL | let y = if let Some(y) = x { y } else { todo!() }; - | ++++++++++ ++++++++++++++++++++++ -help: alternatively, you might want to use `let else` to handle the variant that isn't matched +help: you might want to use `let else` to handle the variant that isn't matched | LL | let Some(y) = x else { todo!() }; | ++++++++++++++++ |
