aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/adt.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/adt.rs')
-rw-r--r--crates/ra_hir_def/src/adt.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs
index ae99afe39..20e9a1eb5 100644
--- a/crates/ra_hir_def/src/adt.rs
+++ b/crates/ra_hir_def/src/adt.rs
@@ -11,7 +11,7 @@ use ra_arena::{map::ArenaMap, Arena};
11use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; 11use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner};
12 12
13use crate::{ 13use crate::{
14 db::DefDatabase2, trace::Trace, type_ref::TypeRef, AstItemDef, EnumId, HasChildSource, 14 db::DefDatabase, trace::Trace, type_ref::TypeRef, AstItemDef, EnumId, HasChildSource,
15 LocalEnumVariantId, LocalStructFieldId, StructOrUnionId, VariantId, 15 LocalEnumVariantId, LocalStructFieldId, StructOrUnionId, VariantId,
16}; 16};
17 17
@@ -49,10 +49,7 @@ pub struct StructFieldData {
49} 49}
50 50
51impl StructData { 51impl StructData {
52 pub(crate) fn struct_data_query( 52 pub(crate) fn struct_data_query(db: &impl DefDatabase, id: StructOrUnionId) -> Arc<StructData> {
53 db: &impl DefDatabase2,
54 id: StructOrUnionId,
55 ) -> Arc<StructData> {
56 let src = id.source(db); 53 let src = id.source(db);
57 let name = src.value.name().map(|n| n.as_name()); 54 let name = src.value.name().map(|n| n.as_name());
58 let variant_data = VariantData::new(src.value.kind()); 55 let variant_data = VariantData::new(src.value.kind());
@@ -62,7 +59,7 @@ impl StructData {
62} 59}
63 60
64impl EnumData { 61impl EnumData {
65 pub(crate) fn enum_data_query(db: &impl DefDatabase2, e: EnumId) -> Arc<EnumData> { 62 pub(crate) fn enum_data_query(db: &impl DefDatabase, e: EnumId) -> Arc<EnumData> {
66 let src = e.source(db); 63 let src = e.source(db);
67 let name = src.value.name().map(|n| n.as_name()); 64 let name = src.value.name().map(|n| n.as_name());
68 let mut trace = Trace::new_for_arena(); 65 let mut trace = Trace::new_for_arena();
@@ -79,7 +76,7 @@ impl EnumData {
79impl HasChildSource for EnumId { 76impl HasChildSource for EnumId {
80 type ChildId = LocalEnumVariantId; 77 type ChildId = LocalEnumVariantId;
81 type Value = ast::EnumVariant; 78 type Value = ast::EnumVariant;
82 fn child_source(&self, db: &impl DefDatabase2) -> Source<ArenaMap<Self::ChildId, Self::Value>> { 79 fn child_source(&self, db: &impl DefDatabase) -> Source<ArenaMap<Self::ChildId, Self::Value>> {
83 let src = self.source(db); 80 let src = self.source(db);
84 let mut trace = Trace::new_for_map(); 81 let mut trace = Trace::new_for_map();
85 lower_enum(&mut trace, &src.value); 82 lower_enum(&mut trace, &src.value);
@@ -124,7 +121,7 @@ impl HasChildSource for VariantId {
124 type ChildId = LocalStructFieldId; 121 type ChildId = LocalStructFieldId;
125 type Value = Either<ast::TupleFieldDef, ast::RecordFieldDef>; 122 type Value = Either<ast::TupleFieldDef, ast::RecordFieldDef>;
126 123
127 fn child_source(&self, db: &impl DefDatabase2) -> Source<ArenaMap<Self::ChildId, Self::Value>> { 124 fn child_source(&self, db: &impl DefDatabase) -> Source<ArenaMap<Self::ChildId, Self::Value>> {
128 let src = match self { 125 let src = match self {
129 VariantId::EnumVariantId(it) => { 126 VariantId::EnumVariantId(it) => {
130 // I don't really like the fact that we call into parent source 127 // I don't really like the fact that we call into parent source