@@ -107,7 +107,7 @@ impl<'a> IR<'a> {
107107 let expr_stmt = ir:: Stmt :: Expression ( returns, ty) ;
108108 DesugaredAst :: new ( ( expr_stmt, span) , expr. rest )
109109 }
110- None => DesugaredAst :: rest ( expr. rest )
110+ None => DesugaredAst :: rest ( expr. rest ) ,
111111 }
112112 }
113113 ty:: Stmt :: VariableAssign {
@@ -189,7 +189,7 @@ impl<'a> IR<'a> {
189189 right,
190190 ty,
191191 } ;
192-
192+
193193 DesugaredAst :: new ( binary, rest)
194194 }
195195 ty:: Expr :: Literal ( value) => DesugaredAst :: returns ( ir:: Expr :: Literal ( value) ) ,
@@ -278,16 +278,17 @@ impl<'a> IR<'a> {
278278
279279 fn desugar_if_stmt ( & mut self , r#if : If < ty:: Expr , ty:: Stmt > ) -> DesugaredAst < Spanned < ir:: Stmt > > {
280280 let mut insert_before = Vec :: new ( ) ;
281- let mut desugar_inner = |inner : IfInner < ty:: Expr , ty:: Stmt > | -> IfInner < ir:: Expr , ir:: Stmt > {
282- let mut condition_desugar = self . desugar_expr ( inner. condition . 0 ) ;
283- insert_before. append ( & mut condition_desugar. rest ) ;
284- let condition = ( condition_desugar. returns . unwrap ( ) , inner. condition . 1 ) ;
285-
286- IfInner {
287- condition,
288- body : self . desugar_statements ( inner. body ) ,
289- }
290- } ;
281+ let mut desugar_inner =
282+ |inner : IfInner < ty:: Expr , ty:: Stmt > | -> IfInner < ir:: Expr , ir:: Stmt > {
283+ let mut condition_desugar = self . desugar_expr ( inner. condition . 0 ) ;
284+ insert_before. append ( & mut condition_desugar. rest ) ;
285+ let condition = ( condition_desugar. returns . unwrap ( ) , inner. condition . 1 ) ;
286+
287+ IfInner {
288+ condition,
289+ body : self . desugar_statements ( inner. body ) ,
290+ }
291+ } ;
291292
292293 let r#if = If {
293294 then : Box :: new ( desugar_inner ( * r#if. then ) ) ,
@@ -303,11 +304,7 @@ impl<'a> IR<'a> {
303304 DesugaredAst :: new ( ( if_stmt, Span :: default ( ) ) , insert_before)
304305 }
305306
306- fn desugar_if_expr (
307- & mut self ,
308- r#if : If < ty:: Expr , ty:: Stmt > ,
309- ty : Ty ,
310- ) -> DesugaredAst < ir:: Expr > {
307+ fn desugar_if_expr ( & mut self , r#if : If < ty:: Expr , ty:: Stmt > , ty : Ty ) -> DesugaredAst < ir:: Expr > {
311308 let mut insert_before = Vec :: new ( ) ;
312309 let ( final_var_id, final_var_name) = self . init_new_var ( & mut insert_before, ty. clone ( ) ) ;
313310
@@ -360,10 +357,7 @@ impl<'a> IR<'a> {
360357 ) ,
361358 } ;
362359
363- insert_before. push ( (
364- ir:: Stmt :: If ( r#if) ,
365- Span :: default ( ) ,
366- ) ) ;
360+ insert_before. push ( ( ir:: Stmt :: If ( r#if) , Span :: default ( ) ) ) ;
367361 DesugaredAst :: new (
368362 self . new_var_read ( final_var_name, ty, final_var_id) ,
369363 insert_before,
@@ -390,7 +384,7 @@ impl<'a> IR<'a> {
390384 let fun_ty = ir_fun. proto . 0 . ty . fun_return_ty ( ) ;
391385 let span = fun. body . 1 . clone ( ) ;
392386 let body = match fun. body . 0 {
393- ty:: Stmt :: Expression ( ty:: Expr :: Block ( mut statements, _) , _) => {
387+ ty:: Stmt :: Expression ( ty:: Expr :: Block ( statements, _) , _) => {
394388 let statements = self . desugar_statements ( statements) ;
395389 self . desugar_fun_return_expr ( statements, fun_ty. clone ( ) )
396390 }
0 commit comments