Switch order of assists

Destructure in sub-pattern before Destructure in place to favor the
first one
This commit is contained in:
BooksBaum 2021-08-13 19:16:36 +02:00
parent d0cf28322a
commit 384fae7fcd
No known key found for this signature in database
GPG Key ID: 8C831753B888F65A

View File

@ -58,16 +58,6 @@ pub(crate) fn destructure_tuple_binding_impl(
let ident_pat = ctx.find_node_at_offset::<ast::IdentPat>()?; let ident_pat = ctx.find_node_at_offset::<ast::IdentPat>()?;
let data = collect_data(ident_pat, ctx)?; 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 { if with_sub_pattern {
acc.add( acc.add(
AssistId("destructure_tuple_binding_in_sub_pattern", AssistKind::RefactorRewrite), AssistId("destructure_tuple_binding_in_sub_pattern", AssistKind::RefactorRewrite),
@ -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(()) Some(())
} }