diff options
Diffstat (limited to 'crates/ra_hir_expand/src')
-rw-r--r-- | crates/ra_hir_expand/src/diagnostics.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_hir_expand/src/diagnostics.rs b/crates/ra_hir_expand/src/diagnostics.rs index 84ba97b14..e889f070f 100644 --- a/crates/ra_hir_expand/src/diagnostics.rs +++ b/crates/ra_hir_expand/src/diagnostics.rs | |||
@@ -36,8 +36,9 @@ pub trait AstDiagnostic { | |||
36 | 36 | ||
37 | impl dyn Diagnostic { | 37 | impl dyn Diagnostic { |
38 | pub fn syntax_node(&self, db: &impl AstDatabase) -> SyntaxNode { | 38 | pub fn syntax_node(&self, db: &impl AstDatabase) -> SyntaxNode { |
39 | let node = db.parse_or_expand(self.source().file_id).unwrap(); | 39 | let source = self.source(); |
40 | self.source().value.to_node(&node) | 40 | let node = db.parse_or_expand(source.file_id).unwrap(); |
41 | source.value.to_node(&node) | ||
41 | } | 42 | } |
42 | 43 | ||
43 | pub fn downcast_ref<D: Diagnostic>(&self) -> Option<&D> { | 44 | pub fn downcast_ref<D: Diagnostic>(&self) -> Option<&D> { |