aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/child_by_source.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/child_by_source.rs')
-rw-r--r--crates/ra_hir_def/src/child_by_source.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_hir_def/src/child_by_source.rs b/crates/ra_hir_def/src/child_by_source.rs
index 8b6c773ee..7009f21d1 100644
--- a/crates/ra_hir_def/src/child_by_source.rs
+++ b/crates/ra_hir_def/src/child_by_source.rs
@@ -17,11 +17,11 @@ use crate::{
17}; 17};
18 18
19pub trait ChildBySource { 19pub trait ChildBySource {
20 fn child_by_source(&self, db: &impl DefDatabase) -> DynMap; 20 fn child_by_source(&self, db: &dyn DefDatabase) -> DynMap;
21} 21}
22 22
23impl ChildBySource for TraitId { 23impl ChildBySource for TraitId {
24 fn child_by_source(&self, db: &impl DefDatabase) -> DynMap { 24 fn child_by_source(&self, db: &dyn DefDatabase) -> DynMap {
25 let mut res = DynMap::default(); 25 let mut res = DynMap::default();
26 26
27 let data = db.trait_data(*self); 27 let data = db.trait_data(*self);
@@ -47,7 +47,7 @@ impl ChildBySource for TraitId {
47} 47}
48 48
49impl ChildBySource for ImplId { 49impl ChildBySource for ImplId {
50 fn child_by_source(&self, db: &impl DefDatabase) -> DynMap { 50 fn child_by_source(&self, db: &dyn DefDatabase) -> DynMap {
51 let mut res = DynMap::default(); 51 let mut res = DynMap::default();
52 52
53 let data = db.impl_data(*self); 53 let data = db.impl_data(*self);
@@ -73,7 +73,7 @@ impl ChildBySource for ImplId {
73} 73}
74 74
75impl ChildBySource for ModuleId { 75impl ChildBySource for ModuleId {
76 fn child_by_source(&self, db: &impl DefDatabase) -> DynMap { 76 fn child_by_source(&self, db: &dyn DefDatabase) -> DynMap {
77 let crate_def_map = db.crate_def_map(self.krate); 77 let crate_def_map = db.crate_def_map(self.krate);
78 let module_data = &crate_def_map[self.local_id]; 78 let module_data = &crate_def_map[self.local_id];
79 module_data.scope.child_by_source(db) 79 module_data.scope.child_by_source(db)
@@ -81,13 +81,13 @@ impl ChildBySource for ModuleId {
81} 81}
82 82
83impl ChildBySource for ItemScope { 83impl ChildBySource for ItemScope {
84 fn child_by_source(&self, db: &impl DefDatabase) -> DynMap { 84 fn child_by_source(&self, db: &dyn DefDatabase) -> DynMap {
85 let mut res = DynMap::default(); 85 let mut res = DynMap::default();
86 self.declarations().for_each(|item| add_module_def(db, &mut res, item)); 86 self.declarations().for_each(|item| add_module_def(db, &mut res, item));
87 self.impls().for_each(|imp| add_impl(db, &mut res, imp)); 87 self.impls().for_each(|imp| add_impl(db, &mut res, imp));
88 return res; 88 return res;
89 89
90 fn add_module_def(db: &impl DefDatabase, map: &mut DynMap, item: ModuleDefId) { 90 fn add_module_def(db: &dyn DefDatabase, map: &mut DynMap, item: ModuleDefId) {
91 match item { 91 match item {
92 ModuleDefId::FunctionId(func) => { 92 ModuleDefId::FunctionId(func) => {
93 let src = func.lookup(db).source(db); 93 let src = func.lookup(db).source(db);
@@ -126,7 +126,7 @@ impl ChildBySource for ItemScope {
126 _ => (), 126 _ => (),
127 } 127 }
128 } 128 }
129 fn add_impl(db: &impl DefDatabase, map: &mut DynMap, imp: ImplId) { 129 fn add_impl(db: &dyn DefDatabase, map: &mut DynMap, imp: ImplId) {
130 let src = imp.lookup(db).source(db); 130 let src = imp.lookup(db).source(db);
131 map[keys::IMPL].insert(src, imp) 131 map[keys::IMPL].insert(src, imp)
132 } 132 }
@@ -134,7 +134,7 @@ impl ChildBySource for ItemScope {
134} 134}
135 135
136impl ChildBySource for VariantId { 136impl ChildBySource for VariantId {
137 fn child_by_source(&self, db: &impl DefDatabase) -> DynMap { 137 fn child_by_source(&self, db: &dyn DefDatabase) -> DynMap {
138 let mut res = DynMap::default(); 138 let mut res = DynMap::default();
139 139
140 let arena_map = self.child_source(db); 140 let arena_map = self.child_source(db);
@@ -155,7 +155,7 @@ impl ChildBySource for VariantId {
155} 155}
156 156
157impl ChildBySource for EnumId { 157impl ChildBySource for EnumId {
158 fn child_by_source(&self, db: &impl DefDatabase) -> DynMap { 158 fn child_by_source(&self, db: &dyn DefDatabase) -> DynMap {
159 let mut res = DynMap::default(); 159 let mut res = DynMap::default();
160 160
161 let arena_map = self.child_source(db); 161 let arena_map = self.child_source(db);
@@ -170,7 +170,7 @@ impl ChildBySource for EnumId {
170} 170}
171 171
172impl ChildBySource for DefWithBodyId { 172impl ChildBySource for DefWithBodyId {
173 fn child_by_source(&self, db: &impl DefDatabase) -> DynMap { 173 fn child_by_source(&self, db: &dyn DefDatabase) -> DynMap {
174 let body = db.body(*self); 174 let body = db.body(*self);
175 body.item_scope.child_by_source(db) 175 body.item_scope.child_by_source(db)
176 } 176 }