We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e413e4c commit 8d75c38Copy full SHA for 8d75c38
clippy_lints/src/manual_let_else.rs
@@ -73,6 +73,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualLetElse {
73
if !in_external_macro(cx.sess(), stmt.span);
74
if let StmtKind::Local(local) = stmt.kind;
75
if let Some(init) = local.init;
76
+ if local.els.is_none();
77
if init.span.ctxt() == stmt.span.ctxt();
78
if let Some(if_let_or_match) = IfLetOrMatch::parse(cx, init);
79
then {
tests/ui/manual_let_else.rs
@@ -194,4 +194,7 @@ fn not_fire() {
194
};
195
}
196
create_binding_if_some_nf!(v, g());
197
+
198
+ // Already a let-else
199
+ let Some(a) = (if let Some(b) = Some(Some(())) { b } else { return }) else { panic!() };
200
0 commit comments