From 3d92ceec06616bde9e37f82a6fe4c36744caa48f Mon Sep 17 00:00:00 2001 From: Shashank Mittal Date: Fri, 16 Feb 2024 05:31:11 +0530 Subject: [PATCH] fmt fix Signed-off-by: Shashank Mittal --- kclvm/ast_pretty/src/node.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kclvm/ast_pretty/src/node.rs b/kclvm/ast_pretty/src/node.rs index af27ea5cf..f6711fd00 100644 --- a/kclvm/ast_pretty/src/node.rs +++ b/kclvm/ast_pretty/src/node.rs @@ -122,8 +122,10 @@ impl<'p, 'ctx> MutSelfTypedResultWalker<'ctx> for Printer<'p> { self.stmts(&if_stmt.body); self.write_indentation(Indentation::Dedent); if !if_stmt.orelse.is_empty() { - for (_, sub_stmt) in if_stmt.orelse.iter().enumerate(){ - if let ast::Stmt::If(elif_stmt)= &sub_stmt.node{ + for sub_stmt in if_stmt.orelse.iter() { + if let ast::Stmt::If(elif_stmt) = &sub_stmt.node { + // Nested if statements need to be considered, + // so `el` needs to be preceded by the current indentation. self.fill("el"); self.walk_if_stmt(elif_stmt); } else {