mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
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>,
|
fields: impl Iterator<Item = T>,
|
||||||
sorted_fields: impl IntoIterator<Item = T>,
|
sorted_fields: impl IntoIterator<Item = T>,
|
||||||
) {
|
) {
|
||||||
fields.zip(sorted_fields).filter(|(field, sorted)| field != sorted).for_each(
|
fields.zip(sorted_fields).for_each(|(field, sorted_field)| {
|
||||||
|(field, sorted_field)| {
|
ted::replace(field.syntax(), sorted_field.syntax().clone_for_update())
|
||||||
ted::replace(field.syntax(), sorted_field.syntax().clone_for_update());
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compute_fields_ranks(path: &ast::Path, ctx: &AssistContext) -> Option<FxHashMap<String, usize>> {
|
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",
|
"Sort methods",
|
||||||
target,
|
target,
|
||||||
|builder| {
|
|builder| {
|
||||||
for (old, new) in
|
methods.into_iter().zip(sorted).for_each(|(old, new)| {
|
||||||
methods.into_iter().zip(sorted).filter(|(field, sorted)| field != sorted)
|
ted::replace(builder.make_ast_mut(old).syntax(), new.clone_for_update().syntax())
|
||||||
{
|
});
|
||||||
ted::replace(builder.make_ast_mut(old).syntax(), new.clone_for_update().syntax());
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user