diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir_def/src/find_path.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_def/src/item_scope.rs | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_hir_def/src/find_path.rs b/crates/ra_hir_def/src/find_path.rs index 79f4afab6..e6cd89478 100644 --- a/crates/ra_hir_def/src/find_path.rs +++ b/crates/ra_hir_def/src/find_path.rs | |||
@@ -128,7 +128,7 @@ pub(crate) fn find_path_inner( | |||
128 | let mut best_path = None; | 128 | let mut best_path = None; |
129 | let mut best_path_len = max_len; | 129 | let mut best_path_len = max_len; |
130 | 130 | ||
131 | if item.defining_crate(db) == Some(from.krate) { | 131 | if item.krate(db) == Some(from.krate) { |
132 | // Item was defined in the same crate that wants to import it. It cannot be found in any | 132 | // Item was defined in the same crate that wants to import it. It cannot be found in any |
133 | // dependency in this case. | 133 | // dependency in this case. |
134 | 134 | ||
diff --git a/crates/ra_hir_def/src/item_scope.rs b/crates/ra_hir_def/src/item_scope.rs index ede1aa045..d340e1f13 100644 --- a/crates/ra_hir_def/src/item_scope.rs +++ b/crates/ra_hir_def/src/item_scope.rs | |||
@@ -205,7 +205,8 @@ impl ItemInNs { | |||
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | pub fn defining_crate(&self, db: &dyn DefDatabase) -> Option<CrateId> { | 208 | /// Returns the crate defining this item (or `None` if `self` is built-in). |
209 | pub fn krate(&self, db: &dyn DefDatabase) -> Option<CrateId> { | ||
209 | Some(match self { | 210 | Some(match self { |
210 | ItemInNs::Types(did) | ItemInNs::Values(did) => match did { | 211 | ItemInNs::Types(did) | ItemInNs::Values(did) => match did { |
211 | ModuleDefId::ModuleId(id) => id.krate, | 212 | ModuleDefId::ModuleId(id) => id.krate, |