Closed
Description
Lint name: if_same_then_else
I've simplified my code some, but it basically looks like this
if let Some(MyEnum::Variant(_)) = value {
cleanup_some_state();
} else if other_condition {
cleanup_some_state();
} else {
// do more work
}
Clippy generates the if_same_then_else diagnostic for this code.
As a matter of fact, I would love to unify the two identical branches, but as far as I know, I cannot add any other conditions to the "if let".
There should be no message from clippy here, since writing the code the way clippy suggests is not possible
Meta
Rust version (rustc -Vv
):
rustc 1.57.0-nightly (a8f2463c6 2021-10-09)
binary: rustc
commit-hash: a8f2463c68a6532d74a13ec402ec5b513e4e2726
commit-date: 2021-10-09
host: x86_64-pc-windows-msvc
release: 1.57.0-nightly
LLVM version: 13.0.0