fix: Fix general find-path inconsistencies

This commit is contained in:
Lukas Wirth 2024-05-22 13:49:56 +02:00
parent 21ec8f5238
commit c88b421853
32 changed files with 242 additions and 193 deletions

View file

@ -33,16 +33,11 @@ fn mod_item_path(
});
let m = sema_scope.module();
match name_hit_count {
Some(0..=1) | None => m.find_use_path(db.upcast(), *def, prefer_no_std, prefer_prelude),
Some(_) => m.find_use_path_prefixed(
db.upcast(),
*def,
PrefixKind::ByCrate,
prefer_no_std,
prefer_prelude,
),
}
let prefix = match name_hit_count {
Some(0..=1) | None => PrefixKind::Plain,
Some(_) => PrefixKind::ByCrate,
};
m.find_use_path(db.upcast(), *def, prefix, prefer_no_std, prefer_prelude)
}
/// Helper function to get path to `ModuleDef` as string