diff options
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 1d5624f8f..c7f77e7a3 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -31,7 +31,7 @@ use rustc_hash::FxHashMap; | |||
31 | 31 | ||
32 | use crate::{ | 32 | use crate::{ |
33 | Module, Function, Struct, StructField, Enum, EnumVariant, Path, Name, ImplBlock, | 33 | Module, Function, Struct, StructField, Enum, EnumVariant, Path, Name, ImplBlock, |
34 | FnSignature, FnScopes, ModuleDef, Crate, | 34 | FnSignature, FnScopes, ModuleDef, AdtDef, |
35 | db::HirDatabase, | 35 | db::HirDatabase, |
36 | type_ref::{TypeRef, Mutability}, | 36 | type_ref::{TypeRef, Mutability}, |
37 | name::KnownName, | 37 | name::KnownName, |
@@ -162,23 +162,6 @@ impl Substs { | |||
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] | ||
166 | pub enum AdtDef { | ||
167 | Struct(Struct), | ||
168 | Enum(Enum), | ||
169 | } | ||
170 | impl_froms!(AdtDef: Struct, Enum); | ||
171 | |||
172 | impl AdtDef { | ||
173 | fn krate(self, db: &impl HirDatabase) -> Option<Crate> { | ||
174 | match self { | ||
175 | AdtDef::Struct(s) => s.module(db), | ||
176 | AdtDef::Enum(e) => e.module(db), | ||
177 | } | ||
178 | .krate(db) | ||
179 | } | ||
180 | } | ||
181 | |||
182 | /// A type. This is based on the `TyKind` enum in rustc (librustc/ty/sty.rs). | 165 | /// A type. This is based on the `TyKind` enum in rustc (librustc/ty/sty.rs). |
183 | /// | 166 | /// |
184 | /// This should be cheap to clone. | 167 | /// This should be cheap to clone. |