mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Add unwrap block assist #4156
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
parent
0b40876b99
commit
6d5f3922f7
1 changed files with 2 additions and 3 deletions
|
@ -76,12 +76,11 @@ pub(crate) fn unwrap_block(ctx: AssistCtx) -> Option<Assist> {
|
|||
})
|
||||
}
|
||||
|
||||
fn extract_expr(cursor_range: TextRange, block_expr: BlockExpr) -> Option<Expr> {
|
||||
let block = block_expr.block()?;
|
||||
fn extract_expr(cursor_range: TextRange, block: BlockExpr) -> Option<Expr> {
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue