From 8476c517c08c21d770a80d4bf0fea28834ae45f0 Mon Sep 17 00:00:00 2001 From: mejrs <> Date: Fri, 23 Dec 2022 22:23:37 +0100 Subject: Don't recommend `if let` if `let else` works --- tests/ui/error-codes/E0005.stderr | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'tests/ui/error-codes') 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` -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!() }; | ++++++++++++++++ -- cgit 1.4.1-3-g733a5