diff options
author | Phil Ellison <[email protected]> | 2019-08-13 07:31:06 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-08-25 10:56:23 +0100 |
commit | 6a04e9ce147cba1ae4da177f271a29eb296a9bef (patch) | |
tree | 5e5c9e9cf85b64381c978995d5ad029570d77476 | |
parent | 200470692ff1023024f0d4a6c35deb43d3045f10 (diff) |
Fix build for Diagnostic type change
-rw-r--r-- | crates/ra_hir/src/diagnostics.rs | 11 |
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 | } |