aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r--crates/ra_hir/src/ty.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 791b6064a..a26776b26 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -23,13 +23,12 @@ use hir_def::{
23 GenericDefId, HasModule, Lookup, TraitId, TypeAliasId, 23 GenericDefId, HasModule, Lookup, TraitId, TypeAliasId,
24}; 24};
25use hir_expand::name::Name; 25use hir_expand::name::Name;
26use ra_db::{impl_intern_key, salsa}; 26use ra_db::{impl_intern_key, salsa, CrateId};
27 27
28use crate::{ 28use crate::{
29 db::HirDatabase, 29 db::HirDatabase,
30 ty::primitive::{FloatTy, IntTy, Uncertain}, 30 ty::primitive::{FloatTy, IntTy, Uncertain},
31 util::make_mut_slice, 31 util::make_mut_slice,
32 Crate,
33}; 32};
34use display::{HirDisplay, HirFormatter}; 33use display::{HirDisplay, HirFormatter};
35 34
@@ -162,7 +161,7 @@ impl TypeCtor {
162 } 161 }
163 } 162 }
164 163
165 pub fn krate(self, db: &impl HirDatabase) -> Option<Crate> { 164 pub fn krate(self, db: &impl HirDatabase) -> Option<CrateId> {
166 match self { 165 match self {
167 TypeCtor::Bool 166 TypeCtor::Bool
168 | TypeCtor::Char 167 | TypeCtor::Char
@@ -178,11 +177,9 @@ impl TypeCtor {
178 | TypeCtor::Tuple { .. } => None, 177 | TypeCtor::Tuple { .. } => None,
179 // Closure's krate is irrelevant for coherence I would think? 178 // Closure's krate is irrelevant for coherence I would think?
180 TypeCtor::Closure { .. } => None, 179 TypeCtor::Closure { .. } => None,
181 TypeCtor::Adt(adt) => Some(adt.module(db).krate.into()), 180 TypeCtor::Adt(adt) => Some(adt.module(db).krate),
182 TypeCtor::FnDef(callable) => Some(callable.krate(db).into()), 181 TypeCtor::FnDef(callable) => Some(callable.krate(db)),
183 TypeCtor::AssociatedType(type_alias) => { 182 TypeCtor::AssociatedType(type_alias) => Some(type_alias.lookup(db).module(db).krate),
184 Some(type_alias.lookup(db).module(db).krate.into())
185 }
186 } 183 }
187 } 184 }
188 185