Skip to content

Commit 2a48370

Browse files
committed
fixes
1 parent dd9dcca commit 2a48370

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

crates/ide-assists/src/handlers/add_braces.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub(crate) fn add_braces(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<(
3434
acc.add(
3535
AssistId("add_braces", AssistKind::RefactorRewrite),
3636
match expr_type {
37-
ParentType::ClosureExpr => "Add braces to lambda expression",
37+
ParentType::ClosureExpr => "Add braces to closure body",
3838
ParentType::MatchArmExpr => "Add braces to arm expression",
3939
},
4040
expr.syntax().text_range(),
@@ -46,9 +46,7 @@ pub(crate) fn add_braces(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<(
4646

4747
builder.replace(expr.syntax().text_range(), block_expr.syntax().text());
4848
},
49-
);
50-
51-
Some(())
49+
)
5250
}
5351

5452
enum ParentType {
@@ -58,7 +56,7 @@ enum ParentType {
5856

5957
fn get_replacement_node(ctx: &AssistContext<'_>) -> Option<(ParentType, ast::Expr)> {
6058
if let Some(match_arm) = ctx.find_node_at_offset::<ast::MatchArm>() {
61-
let match_arm_expr = match_arm.syntax().children().find_map(ast::Expr::cast)?;
59+
let match_arm_expr = match_arm.expr()?;
6260

6361
if matches!(match_arm_expr, ast::Expr::BlockExpr(_)) {
6462
return None;

0 commit comments

Comments
 (0)