diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-03-09 23:14:11 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-09 23:14:11 +0100 |
| commit | ec09e70ee1d662553a70b4826a07cb8d2e1083ac (patch) | |
| tree | 32bfc82bbb4ed77f23c992caa9da95d1ebf5288a /src/test/ui/error-codes | |
| parent | d5c05fcc8ab7eae499d7bd9bd44d5d005fdc1fc3 (diff) | |
| parent | c3a998e82a50b66e8f6f97170cd9117fadf03618 (diff) | |
| download | rust-ec09e70ee1d662553a70b4826a07cb8d2e1083ac.tar.gz rust-ec09e70ee1d662553a70b4826a07cb8d2e1083ac.zip | |
Rollup merge of #94739 - estebank:suggest-let-else, r=oli-obk
Suggest `if let`/`let_else` for refutable pat in `let` r? `````@oli-obk`````
Diffstat (limited to 'src/test/ui/error-codes')
| -rw-r--r-- | src/test/ui/error-codes/E0005.stderr | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr index 208c625a53e..55b1112b5f8 100644 --- a/src/test/ui/error-codes/E0005.stderr +++ b/src/test/ui/error-codes/E0005.stderr @@ -22,8 +22,12 @@ LL | | } = 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 | if let Some(y) = x { /* */ } - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | let y = if let Some(y) = x { y } else { todo!() }; + | ++++++++++ ++++++++++++++++++++++ +help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variant that isn't matched + | +LL | let Some(y) = x else { todo!() }; + | ++++++++++++++++ error: aborting due to previous error |
