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_expand/src/lib.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_expand/src/lib.rs')
-rw-r--r-- | crates/ra_hir_expand/src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs index 7b72eb7a0..6b59ea4c9 100644 --- a/crates/ra_hir_expand/src/lib.rs +++ b/crates/ra_hir_expand/src/lib.rs | |||
@@ -366,7 +366,7 @@ impl<T> InFile<T> { | |||
366 | pub fn as_ref(&self) -> InFile<&T> { | 366 | pub fn as_ref(&self) -> InFile<&T> { |
367 | self.with_value(&self.value) | 367 | self.with_value(&self.value) |
368 | } | 368 | } |
369 | pub fn file_syntax(&self, db: &impl db::AstDatabase) -> SyntaxNode { | 369 | pub fn file_syntax(&self, db: &dyn db::AstDatabase) -> SyntaxNode { |
370 | db.parse_or_expand(self.file_id).expect("source created from invalid file") | 370 | db.parse_or_expand(self.file_id).expect("source created from invalid file") |
371 | } | 371 | } |
372 | } | 372 | } |
@@ -387,7 +387,7 @@ impl<T> InFile<Option<T>> { | |||
387 | impl InFile<SyntaxNode> { | 387 | impl InFile<SyntaxNode> { |
388 | pub fn ancestors_with_macros( | 388 | pub fn ancestors_with_macros( |
389 | self, | 389 | self, |
390 | db: &impl crate::db::AstDatabase, | 390 | db: &dyn db::AstDatabase, |
391 | ) -> impl Iterator<Item = InFile<SyntaxNode>> + '_ { | 391 | ) -> impl Iterator<Item = InFile<SyntaxNode>> + '_ { |
392 | std::iter::successors(Some(self), move |node| match node.value.parent() { | 392 | std::iter::successors(Some(self), move |node| match node.value.parent() { |
393 | Some(parent) => Some(node.with_value(parent)), | 393 | Some(parent) => Some(node.with_value(parent)), |
@@ -402,7 +402,7 @@ impl InFile<SyntaxNode> { | |||
402 | impl InFile<SyntaxToken> { | 402 | impl InFile<SyntaxToken> { |
403 | pub fn ancestors_with_macros( | 403 | pub fn ancestors_with_macros( |
404 | self, | 404 | self, |
405 | db: &impl crate::db::AstDatabase, | 405 | db: &dyn db::AstDatabase, |
406 | ) -> impl Iterator<Item = InFile<SyntaxNode>> + '_ { | 406 | ) -> impl Iterator<Item = InFile<SyntaxNode>> + '_ { |
407 | self.map(|it| it.parent()).ancestors_with_macros(db) | 407 | self.map(|it| it.parent()).ancestors_with_macros(db) |
408 | } | 408 | } |