Skip to content

Commit 1be5e84

Browse files
committed
Use dynamic dispatch in AstDiagnostic
1 parent 30c2e71 commit 1be5e84

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

crates/ra_hir_expand/src/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub trait Diagnostic: Any + Send + Sync + fmt::Debug + 'static {
2828

2929
pub trait AstDiagnostic {
3030
type AST;
31-
fn ast(&self, db: &impl AstDatabase) -> Self::AST;
31+
fn ast(&self, db: &dyn AstDatabase) -> Self::AST;
3232
}
3333

3434
impl dyn Diagnostic {

crates/ra_hir_ty/src/diagnostics.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl Diagnostic for NoSuchField {
3232
impl AstDiagnostic for NoSuchField {
3333
type AST = ast::RecordField;
3434

35-
fn ast(&self, db: &impl AstDatabase) -> Self::AST {
35+
fn ast(&self, db: &dyn AstDatabase) -> Self::AST {
3636
let root = db.parse_or_expand(self.source().file_id).unwrap();
3737
let node = self.source().value.to_node(&root);
3838
ast::RecordField::cast(node).unwrap()
@@ -65,7 +65,7 @@ impl Diagnostic for MissingFields {
6565
impl AstDiagnostic for MissingFields {
6666
type AST = ast::RecordFieldList;
6767

68-
fn ast(&self, db: &impl AstDatabase) -> Self::AST {
68+
fn ast(&self, db: &dyn AstDatabase) -> Self::AST {
6969
let root = db.parse_or_expand(self.source().file_id).unwrap();
7070
let node = self.source().value.to_node(&root);
7171
ast::RecordFieldList::cast(node).unwrap()
@@ -135,7 +135,7 @@ impl Diagnostic for MissingOkInTailExpr {
135135
impl AstDiagnostic for MissingOkInTailExpr {
136136
type AST = ast::Expr;
137137

138-
fn ast(&self, db: &impl AstDatabase) -> Self::AST {
138+
fn ast(&self, db: &dyn AstDatabase) -> Self::AST {
139139
let root = db.parse_or_expand(self.file).unwrap();
140140
let node = self.source().value.to_node(&root);
141141
ast::Expr::cast(node).unwrap()
@@ -163,7 +163,7 @@ impl Diagnostic for BreakOutsideOfLoop {
163163
impl AstDiagnostic for BreakOutsideOfLoop {
164164
type AST = ast::Expr;
165165

166-
fn ast(&self, db: &impl AstDatabase) -> Self::AST {
166+
fn ast(&self, db: &dyn AstDatabase) -> Self::AST {
167167
let root = db.parse_or_expand(self.file).unwrap();
168168
let node = self.source().value.to_node(&root);
169169
ast::Expr::cast(node).unwrap()
@@ -191,7 +191,7 @@ impl Diagnostic for MissingUnsafe {
191191
impl AstDiagnostic for MissingUnsafe {
192192
type AST = ast::Expr;
193193

194-
fn ast(&self, db: &impl AstDatabase) -> Self::AST {
194+
fn ast(&self, db: &dyn AstDatabase) -> Self::AST {
195195
let root = db.parse_or_expand(self.source().file_id).unwrap();
196196
let node = self.source().value.to_node(&root);
197197
ast::Expr::cast(node).unwrap()

0 commit comments

Comments
 (0)