mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
fix: Fix general find-path inconsistencies
This commit is contained in:
parent
21ec8f5238
commit
c88b421853
32 changed files with 242 additions and 193 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue