From 6c41a205a908eb94f139f968f803e728fc3418c6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 28 Aug 2018 14:21:37 +0300 Subject: join any block --- crates/libeditor/src/typing.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crates/libeditor/src') diff --git a/crates/libeditor/src/typing.rs b/crates/libeditor/src/typing.rs index 3a3776c26..daa57983f 100644 --- a/crates/libeditor/src/typing.rs +++ b/crates/libeditor/src/typing.rs @@ -84,7 +84,7 @@ fn remove_newline( offset: TextUnit, ) { if node.kind() == WHITESPACE && node_text.bytes().filter(|&b| b == b'\n').count() == 1 { - if join_lambda_body(edit, node).is_some() { + if join_single_expr_block(edit, node).is_some() { return } match (node.prev_sibling(), node.next_sibling()) { @@ -118,13 +118,12 @@ fn remove_newline( ); } -fn join_lambda_body( +fn join_single_expr_block( edit: &mut EditBuilder, node: SyntaxNodeRef, ) -> Option<()> { let block = ast::Block::cast(node.parent()?)?; let block_expr = ast::BlockExpr::cast(block.syntax().parent()?)?; - let _lambda = ast::LambdaExpr::cast(block_expr.syntax().parent()?)?; let expr = single_expr(block)?; edit.replace( block_expr.syntax().range(), -- cgit v1.2.3