Skip to content

Commit 6d5f392

Browse files
committed
Add unwrap block assist #4156
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
1 parent 0b40876 commit 6d5f392

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

crates/ra_assists/src/handlers/unwrap_block.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@ pub(crate) fn unwrap_block(ctx: AssistCtx) -> Option<Assist> {
7676
})
7777
}
7878

79-
fn extract_expr(cursor_range: TextRange, block_expr: BlockExpr) -> Option<Expr> {
80-
let block = block_expr.block()?;
79+
fn extract_expr(cursor_range: TextRange, block: BlockExpr) -> Option<Expr> {
8180
let cursor_in_range = block.l_curly_token()?.text_range().contains_range(cursor_range);
8281

8382
if cursor_in_range {
84-
Some(unwrap_trivial_block(block_expr))
83+
Some(unwrap_trivial_block(block))
8584
} else {
8685
None
8786
}

0 commit comments

Comments
 (0)