diff options
author | Luca Barbieri <[email protected]> | 2020-04-03 20:12:09 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-04-09 10:50:37 +0100 |
commit | 60f4d7bd8c0ecb9f23557464e824140a2be8f41a (patch) | |
tree | 00aea343b133272e1df072bd7c839fddf07f36f6 /crates/ra_fmt | |
parent | 85956932872481cf4813c5e7794d981a9edb4623 (diff) |
Provide more complete AST accessors to support usage in rustc
Diffstat (limited to 'crates/ra_fmt')
-rw-r--r-- | crates/ra_fmt/src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_fmt/src/lib.rs b/crates/ra_fmt/src/lib.rs index db27f9b83..0b4ba1bbe 100644 --- a/crates/ra_fmt/src/lib.rs +++ b/crates/ra_fmt/src/lib.rs | |||
@@ -60,10 +60,10 @@ pub fn extract_trivial_expression(block: &ast::BlockExpr) -> Option<ast::Expr> { | |||
60 | } else { | 60 | } else { |
61 | // Unwrap `{ continue; }` | 61 | // Unwrap `{ continue; }` |
62 | let (stmt,) = block.statements().next_tuple()?; | 62 | let (stmt,) = block.statements().next_tuple()?; |
63 | if has_anything_else(stmt.syntax()) { | ||
64 | return None; | ||
65 | } | ||
66 | 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()) { | ||
65 | return None; | ||
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), |