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 @@ -710,7 +710,12 @@ impl Rewrite for ast::Stmt {
710
710
} ;
711
711
712
712
let shape = shape. sub_width ( suffix. len ( ) ) ?;
713
- format_expr ( ex, ExprType :: Statement , context, shape) . map ( |s| s + suffix)
713
+ let expr_type = if stmt_is_expr ( & self ) {
714
+ ExprType :: SubExpression
715
+ } else {
716
+ ExprType :: Statement
717
+ } ;
718
+ format_expr ( ex, expr_type, context, shape) . map ( |s| s + suffix)
714
719
}
715
720
ast:: StmtKind :: Mac ( ..) | ast:: StmtKind :: Item ( ..) => None ,
716
721
} ;
@@ -799,11 +804,7 @@ fn to_control_flow(expr: &ast::Expr, expr_type: ExprType) -> Option<ControlFlow>
799
804
}
800
805
801
806
fn choose_matcher ( pats : & [ & ast:: Pat ] ) -> & ' static str {
802
- if pats. is_empty ( ) {
803
- ""
804
- } else {
805
- "let"
806
- }
807
+ if pats. is_empty ( ) { "" } else { "let" }
807
808
}
808
809
809
810
impl < ' a > ControlFlow < ' a > {
You can’t perform that action at this time.
0 commit comments