diff options
author | Aleksey Kladov <[email protected]> | 2019-07-19 08:43:01 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-19 11:16:25 +0100 |
commit | e2b28f5bb8043e92b10f6a40696131007fc9dfe2 (patch) | |
tree | c14306038e386d71ddc894d63415bf8e9a94f7e8 /crates/ra_hir/src/diagnostics.rs | |
parent | 7e02aa0efff228126ffc43e81e5e127e1b9e32dd (diff) |
migrate ra_hir to the new rowan
Diffstat (limited to 'crates/ra_hir/src/diagnostics.rs')
-rw-r--r-- | crates/ra_hir/src/diagnostics.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_hir/src/diagnostics.rs b/crates/ra_hir/src/diagnostics.rs index c97f0656d..0290483b3 100644 --- a/crates/ra_hir/src/diagnostics.rs +++ b/crates/ra_hir/src/diagnostics.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use std::{any::Any, fmt}; | 1 | use std::{any::Any, fmt}; |
2 | 2 | ||
3 | use ra_syntax::{ast, AstNode, AstPtr, SyntaxNode, SyntaxNodePtr, TextRange, TreeArc}; | 3 | use ra_syntax::{ast, AstNode, AstPtr, SyntaxNode, SyntaxNodePtr, TextRange}; |
4 | use relative_path::RelativePathBuf; | 4 | use relative_path::RelativePathBuf; |
5 | 5 | ||
6 | use crate::{HirDatabase, HirFileId, Name}; | 6 | use crate::{HirDatabase, HirFileId, Name}; |
@@ -33,9 +33,9 @@ pub trait AstDiagnostic { | |||
33 | } | 33 | } |
34 | 34 | ||
35 | impl dyn Diagnostic { | 35 | impl dyn Diagnostic { |
36 | pub fn syntax_node(&self, db: &impl HirDatabase) -> TreeArc<SyntaxNode> { | 36 | pub fn syntax_node(&self, db: &impl HirDatabase) -> SyntaxNode { |
37 | let node = db.parse_or_expand(self.file()).unwrap(); | 37 | let node = db.parse_or_expand(self.file()).unwrap(); |
38 | self.syntax_node_ptr().to_node(&*node).to_owned() | 38 | self.syntax_node_ptr().to_node(&node) |
39 | } | 39 | } |
40 | 40 | ||
41 | pub fn downcast_ref<D: Diagnostic>(&self) -> Option<&D> { | 41 | pub fn downcast_ref<D: Diagnostic>(&self) -> Option<&D> { |
@@ -143,11 +143,11 @@ impl Diagnostic for MissingFields { | |||
143 | } | 143 | } |
144 | 144 | ||
145 | impl AstDiagnostic for MissingFields { | 145 | impl AstDiagnostic for MissingFields { |
146 | type AST = TreeArc<ast::NamedFieldList>; | 146 | type AST = ast::NamedFieldList; |
147 | 147 | ||
148 | fn ast(&self, db: &impl HirDatabase) -> Self::AST { | 148 | fn ast(&self, db: &impl HirDatabase) -> Self::AST { |
149 | let root = db.parse_or_expand(self.file()).unwrap(); | 149 | let root = db.parse_or_expand(self.file()).unwrap(); |
150 | let node = self.syntax_node_ptr().to_node(&*root); | 150 | let node = self.syntax_node_ptr().to_node(&root); |
151 | ast::NamedFieldList::cast(&node).unwrap().to_owned() | 151 | ast::NamedFieldList::cast(node).unwrap() |
152 | } | 152 | } |
153 | } | 153 | } |