diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-02 20:20:24 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-02 20:20:24 +0100 |
commit | 7faec1c30046769d4ae490e15cf5405bcfbdeef8 (patch) | |
tree | 6d268b721027a5350928a6c5a0ec227b5fde8ebc /crates/ra_fmt/src/lib.rs | |
parent | a8397deab914240aca8f015fb3736689919c0a5b (diff) | |
parent | e94587e3153b52684fd3f6b82c8e7efc09ff5c8d (diff) |
Merge #1752
1752: Always wrap blocks into block expressions r=flodiebold a=matklad
This way, things like function bodies are expressions, and we don't have to single them out
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_fmt/src/lib.rs')
-rw-r--r-- | crates/ra_fmt/src/lib.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crates/ra_fmt/src/lib.rs b/crates/ra_fmt/src/lib.rs index b09478d7a..e22ac9753 100644 --- a/crates/ra_fmt/src/lib.rs +++ b/crates/ra_fmt/src/lib.rs | |||
@@ -34,7 +34,8 @@ fn prev_tokens(token: SyntaxToken) -> impl Iterator<Item = SyntaxToken> { | |||
34 | successors(token.prev_token(), |token| token.prev_token()) | 34 | successors(token.prev_token(), |token| token.prev_token()) |
35 | } | 35 | } |
36 | 36 | ||
37 | pub fn extract_trivial_expression(block: &ast::Block) -> Option<ast::Expr> { | 37 | pub fn extract_trivial_expression(expr: &ast::BlockExpr) -> Option<ast::Expr> { |
38 | let block = expr.block()?; | ||
38 | let expr = block.expr()?; | 39 | let expr = block.expr()?; |
39 | if expr.syntax().text().contains_char('\n') { | 40 | if expr.syntax().text().contains_char('\n') { |
40 | return None; | 41 | return None; |