From 9faea2364dee4fbc9391ad233c570b70256ef002 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 13 Mar 2020 16:05:46 +0100 Subject: 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). --- crates/ra_hir_expand/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir_expand/src/lib.rs') 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 InFile { pub fn as_ref(&self) -> InFile<&T> { self.with_value(&self.value) } - pub fn file_syntax(&self, db: &impl db::AstDatabase) -> SyntaxNode { + pub fn file_syntax(&self, db: &dyn db::AstDatabase) -> SyntaxNode { db.parse_or_expand(self.file_id).expect("source created from invalid file") } } @@ -387,7 +387,7 @@ impl InFile> { impl InFile { pub fn ancestors_with_macros( self, - db: &impl crate::db::AstDatabase, + db: &dyn db::AstDatabase, ) -> impl Iterator> + '_ { std::iter::successors(Some(self), move |node| match node.value.parent() { Some(parent) => Some(node.with_value(parent)), @@ -402,7 +402,7 @@ impl InFile { impl InFile { pub fn ancestors_with_macros( self, - db: &impl crate::db::AstDatabase, + db: &dyn db::AstDatabase, ) -> impl Iterator> + '_ { self.map(|it| it.parent()).ancestors_with_macros(db) } -- cgit v1.2.3