Apply the assist to itself
This commit is contained in:
parent
1f20804b6e
commit
6321b25a21
@ -32,16 +32,10 @@ pub(crate) fn convert_match_to_let_else(acc: &mut Assists, ctx: &AssistContext<'
|
|||||||
let let_stmt: ast::LetStmt = ctx.find_node_at_offset()?;
|
let let_stmt: ast::LetStmt = ctx.find_node_at_offset()?;
|
||||||
let binding = let_stmt.pat()?;
|
let binding = let_stmt.pat()?;
|
||||||
|
|
||||||
let initializer = match let_stmt.initializer() {
|
let Some(ast::Expr::MatchExpr(initializer)) = let_stmt.initializer() else { return None };
|
||||||
Some(ast::Expr::MatchExpr(it)) => it,
|
|
||||||
_ => return None,
|
|
||||||
};
|
|
||||||
let initializer_expr = initializer.expr()?;
|
let initializer_expr = initializer.expr()?;
|
||||||
|
|
||||||
let (extracting_arm, diverging_arm) = match find_arms(ctx, &initializer) {
|
let Some((extracting_arm, diverging_arm)) = find_arms(ctx, &initializer) else { return None };
|
||||||
Some(it) => it,
|
|
||||||
None => return None,
|
|
||||||
};
|
|
||||||
if extracting_arm.guard().is_some() {
|
if extracting_arm.guard().is_some() {
|
||||||
cov_mark::hit!(extracting_arm_has_guard);
|
cov_mark::hit!(extracting_arm_has_guard);
|
||||||
return None;
|
return None;
|
||||||
|
Loading…
Reference in New Issue
Block a user