diff options
author | Aleksey Kladov <[email protected]> | 2020-03-13 15:05:46 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-03-16 16:42:30 +0000 |
commit | 9faea2364dee4fbc9391ad233c570b70256ef002 (patch) | |
tree | 160af959553ce57fdfcbc0a6c79bafcc3611aeea /crates/ra_hir_def/src/body/lower.rs | |
parent | 648df02953a6ebf87a5876668eceba208687e8a7 (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/body/lower.rs')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 54b5591d3..6238de606 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -36,7 +36,7 @@ use crate::{ | |||
36 | }; | 36 | }; |
37 | 37 | ||
38 | pub(super) fn lower( | 38 | pub(super) fn lower( |
39 | db: &impl DefDatabase, | 39 | db: &dyn DefDatabase, |
40 | def: DefWithBodyId, | 40 | def: DefWithBodyId, |
41 | expander: Expander, | 41 | expander: Expander, |
42 | params: Option<ast::ParamList>, | 42 | params: Option<ast::ParamList>, |
@@ -58,8 +58,8 @@ pub(super) fn lower( | |||
58 | .collect(params, body) | 58 | .collect(params, body) |
59 | } | 59 | } |
60 | 60 | ||
61 | struct ExprCollector<DB> { | 61 | struct ExprCollector<'a> { |
62 | db: DB, | 62 | db: &'a dyn DefDatabase, |
63 | def: DefWithBodyId, | 63 | def: DefWithBodyId, |
64 | expander: Expander, | 64 | expander: Expander, |
65 | 65 | ||
@@ -67,10 +67,7 @@ struct ExprCollector<DB> { | |||
67 | source_map: BodySourceMap, | 67 | source_map: BodySourceMap, |
68 | } | 68 | } |
69 | 69 | ||
70 | impl<'a, DB> ExprCollector<&'a DB> | 70 | impl ExprCollector<'_> { |
71 | where | ||
72 | DB: DefDatabase, | ||
73 | { | ||
74 | fn collect( | 71 | fn collect( |
75 | mut self, | 72 | mut self, |
76 | param_list: Option<ast::ParamList>, | 73 | param_list: Option<ast::ParamList>, |