Don't filter equal nodes in reorder assists
This commit is contained in:
parent
b290cd5782
commit
d5c9de65c5
@ -83,11 +83,9 @@ fn replace<T: AstNode + PartialEq>(
|
||||
fields: impl Iterator<Item = T>,
|
||||
sorted_fields: impl IntoIterator<Item = T>,
|
||||
) {
|
||||
fields.zip(sorted_fields).filter(|(field, sorted)| field != sorted).for_each(
|
||||
|(field, sorted_field)| {
|
||||
ted::replace(field.syntax(), sorted_field.syntax().clone_for_update());
|
||||
},
|
||||
);
|
||||
fields.zip(sorted_fields).for_each(|(field, sorted_field)| {
|
||||
ted::replace(field.syntax(), sorted_field.syntax().clone_for_update())
|
||||
});
|
||||
}
|
||||
|
||||
fn compute_fields_ranks(path: &ast::Path, ctx: &AssistContext) -> Option<FxHashMap<String, usize>> {
|
||||
|
@ -79,11 +79,9 @@ pub(crate) fn reorder_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
|
||||
"Sort methods",
|
||||
target,
|
||||
|builder| {
|
||||
for (old, new) in
|
||||
methods.into_iter().zip(sorted).filter(|(field, sorted)| field != sorted)
|
||||
{
|
||||
ted::replace(builder.make_ast_mut(old).syntax(), new.clone_for_update().syntax());
|
||||
}
|
||||
methods.into_iter().zip(sorted).for_each(|(old, new)| {
|
||||
ted::replace(builder.make_ast_mut(old).syntax(), new.clone_for_update().syntax())
|
||||
});
|
||||
},
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user