diff options
author | Kirill Bulatov <[email protected]> | 2020-08-10 20:53:10 +0100 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-08-11 13:09:08 +0100 |
commit | 936861993935d5b2c78b953e2f4b719e1992bd73 (patch) | |
tree | 93f3e8392946b8cb7df98faeb96088dcf82c0db8 /crates/ra_hir_def | |
parent | 9963f43d51071ea02f8f6d490b9c49882034b42c (diff) |
Make the fix AST source Optional
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/diagnostics.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_hir_def/src/diagnostics.rs b/crates/ra_hir_def/src/diagnostics.rs index be9612846..033be683c 100644 --- a/crates/ra_hir_def/src/diagnostics.rs +++ b/crates/ra_hir_def/src/diagnostics.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use std::any::Any; | 3 | use std::any::Any; |
4 | 4 | ||
5 | use hir_expand::diagnostics::{AstDiagnostic, Diagnostic}; | 5 | use hir_expand::diagnostics::{Diagnostic, DiagnosticWithFix}; |
6 | use ra_syntax::{ast, AstPtr, SyntaxNodePtr}; | 6 | use ra_syntax::{ast, AstPtr, SyntaxNodePtr}; |
7 | 7 | ||
8 | use hir_expand::{HirFileId, InFile}; | 8 | use hir_expand::{HirFileId, InFile}; |
@@ -26,10 +26,10 @@ impl Diagnostic for UnresolvedModule { | |||
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | impl AstDiagnostic for UnresolvedModule { | 29 | impl DiagnosticWithFix for UnresolvedModule { |
30 | type AST = ast::Module; | 30 | type AST = ast::Module; |
31 | fn fix_source(&self, db: &dyn hir_expand::db::AstDatabase) -> Self::AST { | 31 | fn fix_source(&self, db: &dyn hir_expand::db::AstDatabase) -> Option<Self::AST> { |
32 | let root = db.parse_or_expand(self.file).unwrap(); | 32 | let root = db.parse_or_expand(self.file)?; |
33 | self.decl.to_node(&root) | 33 | Some(self.decl.to_node(&root)) |
34 | } | 34 | } |
35 | } | 35 | } |