We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
destructure_tuple_binding
1 parent 4aaa592 commit 6f68cd3Copy full SHA for 6f68cd3
crates/ide-assists/src/handlers/destructure_tuple_binding.rs
@@ -177,10 +177,12 @@ fn edit_tuple_assignment(
177
178
if let Some(cap) = ctx.config.snippet_cap {
179
// place cursor on first tuple name
180
- let ast::Pat::IdentPat(first_pat) = tuple_pat.fields().next().unwrap() else {
181
- unreachable!()
182
- };
183
- edit.add_tabstop_before(cap, first_pat.name().unwrap())
+ if let Some(ast::Pat::IdentPat(first_pat)) = tuple_pat.fields().next() {
+ edit.add_tabstop_before(
+ cap,
+ first_pat.name().expect("first ident pattern should have a name"),
184
+ )
185
+ }
186
}
187
188
AssignmentEdit { ident_pat, tuple_pat, in_sub_pattern }
0 commit comments