diff --git a/compiler/passes/src/static_single_assignment/rename_expression.rs b/compiler/passes/src/static_single_assignment/rename_expression.rs index 9c016a9aa8..82715247ec 100644 --- a/compiler/passes/src/static_single_assignment/rename_expression.rs +++ b/compiler/passes/src/static_single_assignment/rename_expression.rs @@ -246,10 +246,13 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> { // Note that we do not construct new assignment statement for the tuple expression, since tuple expressions are not supported. // TODO: Fix when tuple expressions are supported. - (Expression::Tuple(TupleExpression { - elements, - span: input.span, - }), statements) + ( + Expression::Tuple(TupleExpression { + elements, + span: input.span, + }), + statements, + ) } /// Consumes a unary expression, accumulating any statements that are generated. diff --git a/compiler/passes/src/static_single_assignment/rename_program.rs b/compiler/passes/src/static_single_assignment/rename_program.rs index 1b5e71917b..ed9af19ca8 100644 --- a/compiler/passes/src/static_single_assignment/rename_program.rs +++ b/compiler/passes/src/static_single_assignment/rename_program.rs @@ -17,7 +17,10 @@ use crate::StaticSingleAssigner; use itertools::Itertools; -use leo_ast::{Block, Expression, ExpressionConsumer, Function, FunctionConsumer, Identifier, Program, ProgramConsumer, ReturnStatement, Statement, StatementConsumer, TernaryExpression, TupleExpression}; +use leo_ast::{ + Block, Expression, Function, FunctionConsumer, Identifier, Program, ProgramConsumer, ReturnStatement, Statement, + StatementConsumer, TernaryExpression, TupleExpression, +}; impl FunctionConsumer for StaticSingleAssigner<'_> { type Output = Function; @@ -64,7 +67,7 @@ impl FunctionConsumer for StaticSingleAssigner<'_> { // Create an assignment statement for the element expression in the tuple. let place = Expression::Identifier(Identifier { name: self.unique_symbol("$ret"), - span: Default::default() + span: Default::default(), }); let value = Expression::Ternary(TernaryExpression { condition: Box::new(guard.clone()), @@ -74,7 +77,6 @@ impl FunctionConsumer for StaticSingleAssigner<'_> { }); stmts.push(Self::simple_assign_statement(place.clone(), value)); place - }) .collect(), span: Default::default(), @@ -85,17 +87,17 @@ impl FunctionConsumer for StaticSingleAssigner<'_> { (expr, acc) => { let place = Expression::Identifier(Identifier { name: self.unique_symbol("$ret"), - span: Default::default() + span: Default::default(), }); let value = Expression::Ternary(TernaryExpression { - condition: Box::new(guard.clone()), + condition: Box::new(guard), if_true: Box::new(expr), if_false: Box::new(acc), span: Default::default(), }); stmts.push(Self::simple_assign_statement(place.clone(), value)); place - }, + } }, }); diff --git a/compiler/passes/src/static_single_assignment/rename_statement.rs b/compiler/passes/src/static_single_assignment/rename_statement.rs index c10d63e941..b4e6839fa4 100644 --- a/compiler/passes/src/static_single_assignment/rename_statement.rs +++ b/compiler/passes/src/static_single_assignment/rename_statement.rs @@ -16,7 +16,11 @@ use crate::{RenameTable, StaticSingleAssigner}; -use leo_ast::{AssignStatement, BinaryExpression, BinaryOperation, Block, ConditionalStatement, ConsoleStatement, DefinitionStatement, Expression, ExpressionConsumer, Identifier, IterationStatement, Node, ReturnStatement, Statement, StatementConsumer, TernaryExpression, TupleExpression, UnaryExpression, UnaryOperation}; +use leo_ast::{ + AssignStatement, BinaryExpression, BinaryOperation, Block, ConditionalStatement, ConsoleStatement, + DefinitionStatement, Expression, ExpressionConsumer, Identifier, IterationStatement, Node, ReturnStatement, + Statement, StatementConsumer, TernaryExpression, UnaryExpression, UnaryOperation, +}; use leo_span::Symbol; use indexmap::IndexSet;