aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-02 11:31:11 +0100
committerBenjamin Coenen <[email protected]>2020-05-02 11:31:11 +0100
commit6d5f3922f7cf6d6c02521ad947abd63ab4764fca (patch)
treec7d8fa0cf5ecc972c633f112c0dbc8e56b5b6040 /crates
parent0b40876b993ab30421624b831cb03b4042eb0142 (diff)
Add unwrap block assist #4156
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/handlers/unwrap_block.rs5
1 files changed, 2 insertions, 3 deletions
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<Assist> {
76 }) 76 })
77} 77}
78 78
79fn extract_expr(cursor_range: TextRange, block_expr: BlockExpr) -> Option<Expr> { 79fn extract_expr(cursor_range: TextRange, block: BlockExpr) -> Option<Expr> {
80 let block = block_expr.block()?;
81 let cursor_in_range = block.l_curly_token()?.text_range().contains_range(cursor_range); 80 let cursor_in_range = block.l_curly_token()?.text_range().contains_range(cursor_range);
82 81
83 if cursor_in_range { 82 if cursor_in_range {
84 Some(unwrap_trivial_block(block_expr)) 83 Some(unwrap_trivial_block(block))
85 } else { 84 } else {
86 None 85 None
87 } 86 }