Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 6321b25

Browse files
author
Jonas Schievink
committed
Apply the assist to itself
1 parent 1f20804 commit 6321b25

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,10 @@ pub(crate) fn convert_match_to_let_else(acc: &mut Assists, ctx: &AssistContext<'
3232
let let_stmt: ast::LetStmt = ctx.find_node_at_offset()?;
3333
let binding = let_stmt.pat()?;
3434

35-
let initializer = match let_stmt.initializer() {
36-
Some(ast::Expr::MatchExpr(it)) => it,
37-
_ => return None,
38-
};
35+
let Some(ast::Expr::MatchExpr(initializer)) = let_stmt.initializer() else { return None };
3936
let initializer_expr = initializer.expr()?;
4037

41-
let (extracting_arm, diverging_arm) = match find_arms(ctx, &initializer) {
42-
Some(it) => it,
43-
None => return None,
44-
};
38+
let Some((extracting_arm, diverging_arm)) = find_arms(ctx, &initializer) else { return None };
4539
if extracting_arm.guard().is_some() {
4640
cov_mark::hit!(extracting_arm_has_guard);
4741
return None;

0 commit comments

Comments
 (0)