diff options
Diffstat (limited to 'crates/ra_hir/src/adt.rs')
-rw-r--r-- | crates/ra_hir/src/adt.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs index 5e5905f15..45a12dd4d 100644 --- a/crates/ra_hir/src/adt.rs +++ b/crates/ra_hir/src/adt.rs | |||
@@ -10,7 +10,7 @@ use ra_syntax::{ | |||
10 | }; | 10 | }; |
11 | 11 | ||
12 | use crate::{ | 12 | use crate::{ |
13 | Name, AsName, Struct, Union, Enum, EnumVariant, Crate, | 13 | Name, AsName, Struct, Union, Enum, EnumVariant, Crate, AstDatabase, |
14 | HirDatabase, HirFileId, StructField, FieldSource, | 14 | HirDatabase, HirFileId, StructField, FieldSource, |
15 | type_ref::TypeRef, DefDatabase, | 15 | type_ref::TypeRef, DefDatabase, |
16 | }; | 16 | }; |
@@ -55,7 +55,10 @@ impl StructData { | |||
55 | StructData { name, variant_data } | 55 | StructData { name, variant_data } |
56 | } | 56 | } |
57 | 57 | ||
58 | pub(crate) fn struct_data_query(db: &impl DefDatabase, struct_: Struct) -> Arc<StructData> { | 58 | pub(crate) fn struct_data_query( |
59 | db: &(impl DefDatabase + AstDatabase), | ||
60 | struct_: Struct, | ||
61 | ) -> Arc<StructData> { | ||
59 | let (_, struct_def) = struct_.source(db); | 62 | let (_, struct_def) = struct_.source(db); |
60 | Arc::new(StructData::new(&*struct_def)) | 63 | Arc::new(StructData::new(&*struct_def)) |
61 | } | 64 | } |
@@ -68,7 +71,7 @@ fn variants(enum_def: &ast::EnumDef) -> impl Iterator<Item = &ast::EnumVariant> | |||
68 | impl EnumVariant { | 71 | impl EnumVariant { |
69 | pub(crate) fn source_impl( | 72 | pub(crate) fn source_impl( |
70 | &self, | 73 | &self, |
71 | db: &impl DefDatabase, | 74 | db: &(impl DefDatabase + AstDatabase), |
72 | ) -> (HirFileId, TreeArc<ast::EnumVariant>) { | 75 | ) -> (HirFileId, TreeArc<ast::EnumVariant>) { |
73 | let (file_id, enum_def) = self.parent.source(db); | 76 | let (file_id, enum_def) = self.parent.source(db); |
74 | let var = variants(&*enum_def) | 77 | let var = variants(&*enum_def) |
@@ -91,7 +94,7 @@ pub struct EnumData { | |||
91 | } | 94 | } |
92 | 95 | ||
93 | impl EnumData { | 96 | impl EnumData { |
94 | pub(crate) fn enum_data_query(db: &impl DefDatabase, e: Enum) -> Arc<EnumData> { | 97 | pub(crate) fn enum_data_query(db: &(impl DefDatabase + AstDatabase), e: Enum) -> Arc<EnumData> { |
95 | let (_file_id, enum_def) = e.source(db); | 98 | let (_file_id, enum_def) = e.source(db); |
96 | let name = enum_def.name().map(|n| n.as_name()); | 99 | let name = enum_def.name().map(|n| n.as_name()); |
97 | let variants = variants(&*enum_def) | 100 | let variants = variants(&*enum_def) |
@@ -198,7 +201,10 @@ impl VariantDef { | |||
198 | } | 201 | } |
199 | 202 | ||
200 | impl StructField { | 203 | impl StructField { |
201 | pub(crate) fn source_impl(&self, db: &impl DefDatabase) -> (HirFileId, FieldSource) { | 204 | pub(crate) fn source_impl( |
205 | &self, | ||
206 | db: &(impl DefDatabase + AstDatabase), | ||
207 | ) -> (HirFileId, FieldSource) { | ||
202 | let var_data = self.parent.variant_data(db); | 208 | let var_data = self.parent.variant_data(db); |
203 | let fields = var_data.fields().unwrap(); | 209 | let fields = var_data.fields().unwrap(); |
204 | let ss; | 210 | let ss; |