File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -545,7 +545,12 @@ impl Rewrite for ast::Stmt {
545
545
} ;
546
546
547
547
let shape = shape. sub_width ( suffix. len ( ) ) ?;
548
- format_expr ( ex, ExprType :: Statement , context, shape) . map ( |s| s + suffix)
548
+ let expr_type = if stmt_is_expr ( & self ) {
549
+ ExprType :: SubExpression
550
+ } else {
551
+ ExprType :: Statement
552
+ } ;
553
+ format_expr ( ex, expr_type, context, shape) . map ( |s| s + suffix)
549
554
}
550
555
ast:: StmtKind :: Mac ( ..) | ast:: StmtKind :: Item ( ..) => None ,
551
556
} ;
@@ -634,11 +639,7 @@ fn to_control_flow(expr: &ast::Expr, expr_type: ExprType) -> Option<ControlFlow>
634
639
}
635
640
636
641
fn choose_matcher ( pats : & [ & ast:: Pat ] ) -> & ' static str {
637
- if pats. is_empty ( ) {
638
- ""
639
- } else {
640
- "let"
641
- }
642
+ if pats. is_empty ( ) { "" } else { "let" }
642
643
}
643
644
644
645
impl < ' a > ControlFlow < ' a > {
You can’t perform that action at this time.
0 commit comments