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/recursion | |
| 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/recursion')
| -rw-r--r-- | tests/ui/recursion/recursive-types-are-not-uninhabited.stderr | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/tests/ui/recursion/recursive-types-are-not-uninhabited.stderr b/tests/ui/recursion/recursive-types-are-not-uninhabited.stderr index b7521df88ec..1b4d80d9057 100644 --- a/tests/ui/recursion/recursive-types-are-not-uninhabited.stderr +++ b/tests/ui/recursion/recursive-types-are-not-uninhabited.stderr @@ -7,11 +7,7 @@ LL | let Ok(x) = res; = 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 `Result<u32, &R<'_>>` -help: you might want to use `if let` to ignore the variant that isn't matched - | -LL | let x = if let Ok(x) = res { x } 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 Ok(x) = res else { todo!() }; | ++++++++++++++++ |
