@@ -1064,18 +1064,18 @@ impl<'a> State<'a> {
1064
1064
if let Some ( els_inner) = els {
1065
1065
match els_inner. kind {
1066
1066
// Another `else if` block.
1067
- hir:: ExprKind :: If ( i, then , e) => {
1068
- self . cbox ( INDENT_UNIT - 1 ) ;
1067
+ hir:: ExprKind :: If ( i, hir :: Expr { kind : hir :: ExprKind :: Block ( t , None ) , .. } , e) => {
1068
+ self . cbox ( 0 ) ;
1069
1069
self . ibox ( 0 ) ;
1070
1070
self . word ( " else if " ) ;
1071
1071
self . print_expr_as_cond ( i) ;
1072
1072
self . space ( ) ;
1073
- self . print_expr ( then ) ;
1073
+ self . print_block ( t ) ;
1074
1074
self . print_else ( e) ;
1075
1075
}
1076
1076
// Final `else` block.
1077
- hir:: ExprKind :: Block ( b, _ ) => {
1078
- self . cbox ( INDENT_UNIT - 1 ) ;
1077
+ hir:: ExprKind :: Block ( b, None ) => {
1078
+ self . cbox ( 0 ) ;
1079
1079
self . ibox ( 0 ) ;
1080
1080
self . word ( " else " ) ;
1081
1081
self . print_block ( b) ;
@@ -1094,11 +1094,18 @@ impl<'a> State<'a> {
1094
1094
blk : & hir:: Expr < ' _ > ,
1095
1095
elseopt : Option < & hir:: Expr < ' _ > > ,
1096
1096
) {
1097
- self . head ( "if" ) ;
1097
+ self . cbox ( 0 ) ;
1098
+ self . ibox ( 0 ) ;
1099
+ self . word_nbsp ( "if" ) ;
1098
1100
self . print_expr_as_cond ( test) ;
1099
1101
self . space ( ) ;
1100
- self . print_expr ( blk) ;
1101
- self . print_else ( elseopt)
1102
+ match blk. kind {
1103
+ hir:: ExprKind :: Block ( blk, None ) => {
1104
+ self . print_block ( blk) ;
1105
+ self . print_else ( elseopt)
1106
+ }
1107
+ _ => panic ! ( "non-block then expr" ) ,
1108
+ }
1102
1109
}
1103
1110
1104
1111
fn print_anon_const ( & mut self , constant : & hir:: AnonConst ) {
0 commit comments