@@ -116,7 +116,7 @@ pub fn format_expr(
116
116
rw
117
117
} else {
118
118
let prefix = block_prefix ( context, block, shape) ?;
119
- rewrite_block_with_visitor ( context, & prefix, block, shape, false )
119
+ rewrite_block_with_visitor ( context, & prefix, block, shape, true )
120
120
}
121
121
}
122
122
ExprType :: SubExpression => block. rewrite ( context, shape) ,
@@ -603,7 +603,7 @@ pub fn rewrite_block_with_visitor(
603
603
prefix : & str ,
604
604
block : & ast:: Block ,
605
605
shape : Shape ,
606
- is_dummy : bool ,
606
+ has_braces : bool ,
607
607
) -> Option < String > {
608
608
if let rw @ Some ( _) = rewrite_empty_block ( context, block, shape) {
609
609
return rw;
@@ -621,7 +621,7 @@ pub fn rewrite_block_with_visitor(
621
621
ast:: BlockCheckMode :: Default => visitor. last_pos = block. span . lo ( ) ,
622
622
}
623
623
624
- visitor. visit_block ( block, None , is_dummy ) ;
624
+ visitor. visit_block ( block, None , has_braces ) ;
625
625
Some ( format ! ( "{}{}" , prefix, visitor. buffer) )
626
626
}
627
627
@@ -636,7 +636,7 @@ impl Rewrite for ast::Block {
636
636
let prefix = block_prefix ( context, self , shape) ?;
637
637
let shape = shape. offset_left ( last_line_width ( & prefix) ) ?;
638
638
639
- let result = rewrite_block_with_visitor ( context, & prefix, self , shape, false ) ;
639
+ let result = rewrite_block_with_visitor ( context, & prefix, self , shape, true ) ;
640
640
if let Some ( ref result_str) = result {
641
641
if result_str. lines ( ) . count ( ) <= 3 {
642
642
if let rw @ Some ( _) = rewrite_single_line_block ( context, & prefix, self , shape) {
@@ -1067,7 +1067,7 @@ impl<'a> Rewrite for ControlFlow<'a> {
1067
1067
let mut block_context = context. clone ( ) ;
1068
1068
block_context. is_if_else_block = self . else_block . is_some ( ) ;
1069
1069
let block_str =
1070
- rewrite_block_with_visitor ( & block_context, "" , self . block , block_shape, false ) ?;
1070
+ rewrite_block_with_visitor ( & block_context, "" , self . block , block_shape, true ) ?;
1071
1071
1072
1072
let mut result = format ! ( "{}{}" , cond_str, block_str) ;
1073
1073
0 commit comments