about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHayashi Mikihiro <34ttrweoewiwe28@gmail.com>2025-07-01 18:38:50 +0900
committerHayashi Mikihiro <34ttrweoewiwe28@gmail.com>2025-07-01 18:38:50 +0900
commit64d3647d77aeda886be7f8be44d1732e543c7ada (patch)
treee0a51a5f649f0d3c3b1f95658320f0fc38deff5e /src
parent6a52b3a6cf8d1571cf2f9d592fa0740d1abbc35b (diff)
downloadrust-64d3647d77aeda886be7f8be44d1732e543c7ada.tar.gz
rust-64d3647d77aeda886be7f8be44d1732e543c7ada.zip
remove `if-let` chains
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_is_method_with_if_let_method.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_is_method_with_if_let_method.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_is_method_with_if_let_method.rs
index 5ef8ba46b9e..62914ee7f38 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_is_method_with_if_let_method.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_is_method_with_if_let_method.rs
@@ -64,12 +64,13 @@ pub(crate) fn replace_is_method_with_if_let_method(
                     let pat = make.tuple_struct_pat(make.ident_path(text), [var_pat.into()]);
                     let let_expr = make.expr_let(pat.into(), receiver);
 
-                    if let Some(cap) = ctx.config.snippet_cap
-                        && let Some(ast::Pat::TupleStructPat(pat)) = let_expr.pat()
-                        && let Some(first_var) = pat.fields().next()
-                    {
-                        let placeholder = edit.make_placeholder_snippet(cap);
-                        editor.add_annotation(first_var.syntax(), placeholder);
+                    if let Some(cap) = ctx.config.snippet_cap {
+                        if let Some(ast::Pat::TupleStructPat(pat)) = let_expr.pat() {
+                            if let Some(first_var) = pat.fields().next() {
+                                let placeholder = edit.make_placeholder_snippet(cap);
+                                editor.add_annotation(first_var.syntax(), placeholder);
+                            }
+                        }
                     }
 
                     editor.replace(call_expr.syntax(), let_expr.syntax());