From 1be5e848b099efe050c5803abf8b1f96ad4ec0fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Wed, 1 Jul 2020 10:46:27 +0300 Subject: Use dynamic dispatch in AstDiagnostic --- crates/ra_hir_expand/src/diagnostics.rs | 2 +- crates/ra_hir_ty/src/diagnostics.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir_expand/src/diagnostics.rs b/crates/ra_hir_expand/src/diagnostics.rs index 99209c6e8..545cff9bd 100644 --- a/crates/ra_hir_expand/src/diagnostics.rs +++ b/crates/ra_hir_expand/src/diagnostics.rs @@ -28,7 +28,7 @@ pub trait Diagnostic: Any + Send + Sync + fmt::Debug + 'static { pub trait AstDiagnostic { type AST; - fn ast(&self, db: &impl AstDatabase) -> Self::AST; + fn ast(&self, db: &dyn AstDatabase) -> Self::AST; } impl dyn Diagnostic { diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs index a59efb347..0289911de 100644 --- a/crates/ra_hir_ty/src/diagnostics.rs +++ b/crates/ra_hir_ty/src/diagnostics.rs @@ -32,7 +32,7 @@ impl Diagnostic for NoSuchField { impl AstDiagnostic for NoSuchField { type AST = ast::RecordField; - fn ast(&self, db: &impl AstDatabase) -> Self::AST { + fn ast(&self, db: &dyn AstDatabase) -> Self::AST { let root = db.parse_or_expand(self.source().file_id).unwrap(); let node = self.source().value.to_node(&root); ast::RecordField::cast(node).unwrap() @@ -65,7 +65,7 @@ impl Diagnostic for MissingFields { impl AstDiagnostic for MissingFields { type AST = ast::RecordFieldList; - fn ast(&self, db: &impl AstDatabase) -> Self::AST { + fn ast(&self, db: &dyn AstDatabase) -> Self::AST { let root = db.parse_or_expand(self.source().file_id).unwrap(); let node = self.source().value.to_node(&root); ast::RecordFieldList::cast(node).unwrap() @@ -135,7 +135,7 @@ impl Diagnostic for MissingOkInTailExpr { impl AstDiagnostic for MissingOkInTailExpr { type AST = ast::Expr; - fn ast(&self, db: &impl AstDatabase) -> Self::AST { + fn ast(&self, db: &dyn AstDatabase) -> Self::AST { let root = db.parse_or_expand(self.file).unwrap(); let node = self.source().value.to_node(&root); ast::Expr::cast(node).unwrap() @@ -163,7 +163,7 @@ impl Diagnostic for BreakOutsideOfLoop { impl AstDiagnostic for BreakOutsideOfLoop { type AST = ast::Expr; - fn ast(&self, db: &impl AstDatabase) -> Self::AST { + fn ast(&self, db: &dyn AstDatabase) -> Self::AST { let root = db.parse_or_expand(self.file).unwrap(); let node = self.source().value.to_node(&root); ast::Expr::cast(node).unwrap() @@ -191,7 +191,7 @@ impl Diagnostic for MissingUnsafe { impl AstDiagnostic for MissingUnsafe { type AST = ast::Expr; - fn ast(&self, db: &impl AstDatabase) -> Self::AST { + fn ast(&self, db: &dyn AstDatabase) -> Self::AST { let root = db.parse_or_expand(self.source().file_id).unwrap(); let node = self.source().value.to_node(&root); ast::Expr::cast(node).unwrap() -- cgit v1.2.3