Don't lint if the let is already a let-else
We cannot apply the lint for 3-branches like in the added example.
This commit is contained in:
parent
a1db9311dc
commit
01e651f2fe
|
@ -73,6 +73,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualLetElse {
|
|||
if !in_external_macro(cx.sess(), stmt.span);
|
||||
if let StmtKind::Local(local) = stmt.kind;
|
||||
if let Some(init) = local.init;
|
||||
if local.els.is_none();
|
||||
if init.span.ctxt() == stmt.span.ctxt();
|
||||
if let Some(if_let_or_match) = IfLetOrMatch::parse(cx, init);
|
||||
then {
|
||||
|
|
|
@ -194,4 +194,7 @@ fn not_fire() {
|
|||
};
|
||||
}
|
||||
create_binding_if_some_nf!(v, g());
|
||||
|
||||
// Already a let-else
|
||||
let Some(a) = (if let Some(b) = Some(Some(())) { b } else { return }) else { panic!() };
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue