defining_crate -> krate

This commit is contained in:
Jonas Schievink 2020-06-05 13:05:19 +02:00
parent e0e9c6d1a4
commit 86fbd8cc2b
2 changed files with 3 additions and 2 deletions

View File

@ -128,7 +128,7 @@ pub(crate) fn find_path_inner(
let mut best_path = None;
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
// dependency in this case.

View File

@ -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 {
ItemInNs::Types(did) | ItemInNs::Values(did) => match did {
ModuleDefId::ModuleId(id) => id.krate,