From 60f4d7bd8c0ecb9f23557464e824140a2be8f41a Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 3 Apr 2020 21:12:09 +0200 Subject: Provide more complete AST accessors to support usage in rustc --- crates/ra_fmt/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_fmt/src') 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 { } else { // Unwrap `{ continue; }` let (stmt,) = block.statements().next_tuple()?; - if has_anything_else(stmt.syntax()) { - return None; - } if let ast::Stmt::ExprStmt(expr_stmt) = stmt { + if has_anything_else(expr_stmt.syntax()) { + return None; + } let expr = expr_stmt.expr()?; match expr.syntax().kind() { CONTINUE_EXPR | BREAK_EXPR | RETURN_EXPR => return Some(expr), -- cgit v1.2.3