Skip to content

Commit 64d3647

Browse files
committed
remove if-let chains
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
1 parent 6a52b3a commit 64d3647

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_is_method_with_if_let_method.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ pub(crate) fn replace_is_method_with_if_let_method(
6464
let pat = make.tuple_struct_pat(make.ident_path(text), [var_pat.into()]);
6565
let let_expr = make.expr_let(pat.into(), receiver);
6666

67-
if let Some(cap) = ctx.config.snippet_cap
68-
&& let Some(ast::Pat::TupleStructPat(pat)) = let_expr.pat()
69-
&& let Some(first_var) = pat.fields().next()
70-
{
71-
let placeholder = edit.make_placeholder_snippet(cap);
72-
editor.add_annotation(first_var.syntax(), placeholder);
67+
if let Some(cap) = ctx.config.snippet_cap {
68+
if let Some(ast::Pat::TupleStructPat(pat)) = let_expr.pat() {
69+
if let Some(first_var) = pat.fields().next() {
70+
let placeholder = edit.make_placeholder_snippet(cap);
71+
editor.add_annotation(first_var.syntax(), placeholder);
72+
}
73+
}
7374
}
7475

7576
editor.replace(call_expr.syntax(), let_expr.syntax());

0 commit comments

Comments
 (0)