From 6d5f3922f7cf6d6c02521ad947abd63ab4764fca Mon Sep 17 00:00:00 2001 From: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Date: Sat, 2 May 2020 12:31:11 +0200 Subject: Add unwrap block assist #4156 Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> --- crates/ra_assists/src/handlers/unwrap_block.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/handlers/unwrap_block.rs b/crates/ra_assists/src/handlers/unwrap_block.rs index 8912ce645..58649c47e 100644 --- a/crates/ra_assists/src/handlers/unwrap_block.rs +++ b/crates/ra_assists/src/handlers/unwrap_block.rs @@ -76,12 +76,11 @@ pub(crate) fn unwrap_block(ctx: AssistCtx) -> Option { }) } -fn extract_expr(cursor_range: TextRange, block_expr: BlockExpr) -> Option { - let block = block_expr.block()?; +fn extract_expr(cursor_range: TextRange, block: BlockExpr) -> Option { let cursor_in_range = block.l_curly_token()?.text_range().contains_range(cursor_range); if cursor_in_range { - Some(unwrap_trivial_block(block_expr)) + Some(unwrap_trivial_block(block)) } else { None } -- cgit v1.2.3