Fix stable iteration ordering for Map<Name, ...> usages

This commit is contained in:
Lukas Wirth 2024-07-15 11:07:04 +02:00
parent f2d51073d2
commit cde0f69cae
11 changed files with 55 additions and 29 deletions

View file

@ -259,7 +259,7 @@ pub(super) fn add_call_parens<'b>(
fn ref_of_param(ctx: &CompletionContext<'_>, arg: &str, ty: &hir::Type) -> &'static str {
if let Some(derefed_ty) = ty.remove_ref() {
for (name, local) in ctx.locals.iter() {
for (name, local) in ctx.locals.iter().sorted_by_key(|&(k, _)| k.clone()) {
if name.as_str() == arg {
return if local.ty(ctx.db) == derefed_ty {
if ty.is_mutable_reference() {