diff options
Diffstat (limited to 'crates/ra_fmt')
-rw-r--r-- | crates/ra_fmt/src/lib.rs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/crates/ra_fmt/src/lib.rs b/crates/ra_fmt/src/lib.rs index 0b4ba1bbe..1a30b2b3a 100644 --- a/crates/ra_fmt/src/lib.rs +++ b/crates/ra_fmt/src/lib.rs | |||
@@ -57,18 +57,17 @@ pub fn extract_trivial_expression(block: &ast::BlockExpr) -> Option<ast::Expr> { | |||
57 | return None; | 57 | return None; |
58 | } | 58 | } |
59 | return Some(expr); | 59 | return Some(expr); |
60 | } else { | 60 | } |
61 | // Unwrap `{ continue; }` | 61 | // Unwrap `{ continue; }` |
62 | let (stmt,) = block.statements().next_tuple()?; | 62 | let (stmt,) = block.statements().next_tuple()?; |
63 | if let ast::Stmt::ExprStmt(expr_stmt) = stmt { | 63 | if let ast::Stmt::ExprStmt(expr_stmt) = stmt { |
64 | if has_anything_else(expr_stmt.syntax()) { | 64 | if has_anything_else(expr_stmt.syntax()) { |
65 | return None; | 65 | return None; |
66 | } | 66 | } |
67 | let expr = expr_stmt.expr()?; | 67 | let expr = expr_stmt.expr()?; |
68 | match expr.syntax().kind() { | 68 | match expr.syntax().kind() { |
69 | CONTINUE_EXPR | BREAK_EXPR | RETURN_EXPR => return Some(expr), | 69 | CONTINUE_EXPR | BREAK_EXPR | RETURN_EXPR => return Some(expr), |
70 | _ => (), | 70 | _ => (), |
71 | } | ||
72 | } | 71 | } |
73 | } | 72 | } |
74 | None | 73 | None |