Skip to content

Commit

Permalink
Switch order of assists
Browse files Browse the repository at this point in the history
Destructure in sub-pattern before Destructure in place to favor the
first one
  • Loading branch information
Booksbaum committed Aug 13, 2021
1 parent a4ee6c7 commit 5c4e607
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions crates/ide_assists/src/handlers/destructure_tuple_binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,6 @@ pub(crate) fn destructure_tuple_binding_impl(
let ident_pat = ctx.find_node_at_offset::<ast::IdentPat>()?;
let data = collect_data(ident_pat, ctx)?;

acc.add(
AssistId("destructure_tuple_binding", AssistKind::RefactorRewrite),
if with_sub_pattern { "Destructure tuple in place" } else { "Destructure tuple" },
data.range,
|builder| {
edit_tuple_assignment(&data, builder, ctx, false);
edit_tuple_usages(&data, builder, ctx, false);
},
);

if with_sub_pattern {
acc.add(
AssistId("destructure_tuple_binding_in_sub_pattern", AssistKind::RefactorRewrite),
Expand All @@ -80,6 +70,16 @@ pub(crate) fn destructure_tuple_binding_impl(
);
}

acc.add(
AssistId("destructure_tuple_binding", AssistKind::RefactorRewrite),
if with_sub_pattern { "Destructure tuple in place" } else { "Destructure tuple" },
data.range,
|builder| {
edit_tuple_assignment(&data, builder, ctx, false);
edit_tuple_usages(&data, builder, ctx, false);
},
);

Some(())
}

Expand Down

0 comments on commit 5c4e607

Please sign in to comment.