Closed
Description
Description
Take the following line of code (which appears in the ui test for manual_let_else
):
let v = if let Some(v_some) = g() { v_some } else { return };
which declares a new variable called v
. If we run clippy on the following code, we get the suggestion to replace it with
if let Some(v_some) = g() { v_some } else { return };
which declares a new variable called v_some
.
The suggestion should be:
-if let Some(v_some) = g() { v_some } else { return };
+if let Some(v) = g() { v_some } else { return };
Please correct me if I'm wrong, but it looks like we have unit tests that are generating the wrong output.
Version
rustc 1.68.0-nightly (574b64a97 2022-12-31)
binary: rustc
commit-hash: 574b64a97f52162f965bc201e47f0af8279ca65d
commit-date: 2022-12-31
host: aarch64-apple-darwin
release: 1.68.0-nightly
LLVM version: 15.0.6
Additional Labels
No response