From d7a03022f7acfddc866c2f8521915f1a42f7d1a3 Mon Sep 17 00:00:00 2001 From: davidsemakula Date: Tue, 6 Feb 2024 18:40:09 +0300 Subject: [PATCH] handle divergence in child if expr for unnecessary else diagnostic fix --- .../src/handlers/remove_unnecessary_else.rs | 79 +++++++++++++++++-- 1 file changed, 73 insertions(+), 6 deletions(-) diff --git a/crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs b/crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs index 3ba1c20ad6..c6c85256f9 100644 --- a/crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs +++ b/crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs @@ -35,8 +35,12 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &RemoveUnnecessaryElse) -> Option { block.statements().map(|stmt| format!("\n{indent}{stmt}")).join("") } @@ -44,10 +48,30 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &RemoveUnnecessaryElse) -> Option