aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/diagnostics.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/ra_hir/src/diagnostics.rs b/crates/ra_hir/src/diagnostics.rs
index 718345d75..475dd5766 100644
--- a/crates/ra_hir/src/diagnostics.rs
+++ b/crates/ra_hir/src/diagnostics.rs
@@ -154,11 +154,8 @@ impl Diagnostic for MissingOkInTailExpr {
154 fn message(&self) -> String { 154 fn message(&self) -> String {
155 "wrap return expression in Ok".to_string() 155 "wrap return expression in Ok".to_string()
156 } 156 }
157 fn file(&self) -> HirFileId { 157 fn source(&self) -> Source<SyntaxNodePtr> {
158 self.file 158 Source { file_id: self.file, ast: self.expr.into() }
159 }
160 fn syntax_node_ptr(&self) -> SyntaxNodePtr {
161 self.expr.into()
162 } 159 }
163 fn as_any(&self) -> &(dyn Any + Send + 'static) { 160 fn as_any(&self) -> &(dyn Any + Send + 'static) {
164 self 161 self
@@ -169,8 +166,8 @@ impl AstDiagnostic for MissingOkInTailExpr {
169 type AST = ast::Expr; 166 type AST = ast::Expr;
170 167
171 fn ast(&self, db: &impl HirDatabase) -> Self::AST { 168 fn ast(&self, db: &impl HirDatabase) -> Self::AST {
172 let root = db.parse_or_expand(self.file()).unwrap(); 169 let root = db.parse_or_expand(self.file).unwrap();
173 let node = self.syntax_node_ptr().to_node(&root); 170 let node = self.source().ast.to_node(&root);
174 ast::Expr::cast(node).unwrap() 171 ast::Expr::cast(node).unwrap()
175 } 172 }
176} 173}