Skip to content

Commit 6a04e9c

Browse files
theotherphilmatklad
authored andcommitted
Fix build for Diagnostic type change
1 parent 2004706 commit 6a04e9c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

crates/ra_hir/src/diagnostics.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,8 @@ impl Diagnostic for MissingOkInTailExpr {
154154
fn message(&self) -> String {
155155
"wrap return expression in Ok".to_string()
156156
}
157-
fn file(&self) -> HirFileId {
158-
self.file
159-
}
160-
fn syntax_node_ptr(&self) -> SyntaxNodePtr {
161-
self.expr.into()
157+
fn source(&self) -> Source<SyntaxNodePtr> {
158+
Source { file_id: self.file, ast: self.expr.into() }
162159
}
163160
fn as_any(&self) -> &(dyn Any + Send + 'static) {
164161
self
@@ -169,8 +166,8 @@ impl AstDiagnostic for MissingOkInTailExpr {
169166
type AST = ast::Expr;
170167

171168
fn ast(&self, db: &impl HirDatabase) -> Self::AST {
172-
let root = db.parse_or_expand(self.file()).unwrap();
173-
let node = self.syntax_node_ptr().to_node(&root);
169+
let root = db.parse_or_expand(self.file).unwrap();
170+
let node = self.source().ast.to_node(&root);
174171
ast::Expr::cast(node).unwrap()
175172
}
176173
}

0 commit comments

Comments
 (0)