mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
defining_crate -> krate
This commit is contained in:
parent
e0e9c6d1a4
commit
86fbd8cc2b
2 changed files with 3 additions and 2 deletions
|
@ -128,7 +128,7 @@ pub(crate) fn find_path_inner(
|
||||||
let mut best_path = None;
|
let mut best_path = None;
|
||||||
let mut best_path_len = max_len;
|
let mut best_path_len = max_len;
|
||||||
|
|
||||||
if item.defining_crate(db) == Some(from.krate) {
|
if item.krate(db) == Some(from.krate) {
|
||||||
// Item was defined in the same crate that wants to import it. It cannot be found in any
|
// Item was defined in the same crate that wants to import it. It cannot be found in any
|
||||||
// dependency in this case.
|
// dependency in this case.
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,8 @@ impl ItemInNs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn defining_crate(&self, db: &dyn DefDatabase) -> Option<CrateId> {
|
/// Returns the crate defining this item (or `None` if `self` is built-in).
|
||||||
|
pub fn krate(&self, db: &dyn DefDatabase) -> Option<CrateId> {
|
||||||
Some(match self {
|
Some(match self {
|
||||||
ItemInNs::Types(did) | ItemInNs::Values(did) => match did {
|
ItemInNs::Types(did) | ItemInNs::Values(did) => match did {
|
||||||
ModuleDefId::ModuleId(id) => id.krate,
|
ModuleDefId::ModuleId(id) => id.krate,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue