aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/src.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-03-13 15:05:46 +0000
committerAleksey Kladov <[email protected]>2020-03-16 16:42:30 +0000
commit9faea2364dee4fbc9391ad233c570b70256ef002 (patch)
tree160af959553ce57fdfcbc0a6c79bafcc3611aeea /crates/ra_hir_def/src/src.rs
parent648df02953a6ebf87a5876668eceba208687e8a7 (diff)
Use `dyn Trait` for working with databse
It improves compile time in `--release` mode quite a bit, it doesn't really slow things down and, conceptually, it seems closer to what we want the physical architecture to look like (we don't want to monomorphise EVERYTHING in a single leaf crate).
Diffstat (limited to 'crates/ra_hir_def/src/src.rs')
-rw-r--r--crates/ra_hir_def/src/src.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_hir_def/src/src.rs b/crates/ra_hir_def/src/src.rs
index 499375b80..46e90da70 100644
--- a/crates/ra_hir_def/src/src.rs
+++ b/crates/ra_hir_def/src/src.rs
@@ -8,14 +8,14 @@ use crate::{db::DefDatabase, AssocItemLoc, ItemLoc};
8 8
9pub trait HasSource { 9pub trait HasSource {
10 type Value; 10 type Value;
11 fn source(&self, db: &impl DefDatabase) -> InFile<Self::Value>; 11 fn source(&self, db: &dyn DefDatabase) -> InFile<Self::Value>;
12} 12}
13 13
14impl<N: AstNode> HasSource for AssocItemLoc<N> { 14impl<N: AstNode> HasSource for AssocItemLoc<N> {
15 type Value = N; 15 type Value = N;
16 16
17 fn source(&self, db: &impl DefDatabase) -> InFile<N> { 17 fn source(&self, db: &dyn DefDatabase) -> InFile<N> {
18 let node = self.ast_id.to_node(db); 18 let node = self.ast_id.to_node(db.upcast());
19 InFile::new(self.ast_id.file_id, node) 19 InFile::new(self.ast_id.file_id, node)
20 } 20 }
21} 21}
@@ -23,8 +23,8 @@ impl<N: AstNode> HasSource for AssocItemLoc<N> {
23impl<N: AstNode> HasSource for ItemLoc<N> { 23impl<N: AstNode> HasSource for ItemLoc<N> {
24 type Value = N; 24 type Value = N;
25 25
26 fn source(&self, db: &impl DefDatabase) -> InFile<N> { 26 fn source(&self, db: &dyn DefDatabase) -> InFile<N> {
27 let node = self.ast_id.to_node(db); 27 let node = self.ast_id.to_node(db.upcast());
28 InFile::new(self.ast_id.file_id, node) 28 InFile::new(self.ast_id.file_id, node)
29 } 29 }
30} 30}
@@ -32,5 +32,5 @@ impl<N: AstNode> HasSource for ItemLoc<N> {
32pub trait HasChildSource { 32pub trait HasChildSource {
33 type ChildId; 33 type ChildId;
34 type Value; 34 type Value;
35 fn child_source(&self, db: &impl DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>>; 35 fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>>;
36} 36}