diff options
author | Kirill Bulatov <[email protected]> | 2020-08-10 22:37:23 +0100 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-08-11 13:09:08 +0100 |
commit | 29fbc8e02180aac1f4d7819a9626206aa64028a0 (patch) | |
tree | ed97a21451cdb34a33ac984c7df035a5c29ca25e /crates/ra_hir_ty | |
parent | 936861993935d5b2c78b953e2f4b719e1992bd73 (diff) |
Move the DiagnosticsWithFix trait on the ide level
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r-- | crates/ra_hir_ty/src/diagnostics.rs | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs index b34ba5bfc..24435e8a7 100644 --- a/crates/ra_hir_ty/src/diagnostics.rs +++ b/crates/ra_hir_ty/src/diagnostics.rs | |||
@@ -6,8 +6,8 @@ mod unsafe_check; | |||
6 | use std::any::Any; | 6 | use std::any::Any; |
7 | 7 | ||
8 | use hir_def::DefWithBodyId; | 8 | use hir_def::DefWithBodyId; |
9 | use hir_expand::diagnostics::{Diagnostic, DiagnosticSink, DiagnosticWithFix}; | 9 | use hir_expand::diagnostics::{Diagnostic, DiagnosticSink}; |
10 | use hir_expand::{db::AstDatabase, name::Name, HirFileId, InFile}; | 10 | use hir_expand::{name::Name, HirFileId, InFile}; |
11 | use ra_prof::profile; | 11 | use ra_prof::profile; |
12 | use ra_syntax::{ast, AstPtr, SyntaxNodePtr}; | 12 | use ra_syntax::{ast, AstPtr, SyntaxNodePtr}; |
13 | use stdx::format_to; | 13 | use stdx::format_to; |
@@ -46,15 +46,6 @@ impl Diagnostic for NoSuchField { | |||
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | ||
49 | impl DiagnosticWithFix for NoSuchField { | ||
50 | type AST = ast::RecordExprField; | ||
51 | |||
52 | fn fix_source(&self, db: &dyn AstDatabase) -> Option<Self::AST> { | ||
53 | let root = db.parse_or_expand(self.file)?; | ||
54 | Some(self.field.to_node(&root)) | ||
55 | } | ||
56 | } | ||
57 | |||
58 | #[derive(Debug)] | 49 | #[derive(Debug)] |
59 | pub struct MissingFields { | 50 | pub struct MissingFields { |
60 | pub file: HirFileId, | 51 | pub file: HirFileId, |
@@ -88,15 +79,6 @@ impl Diagnostic for MissingFields { | |||
88 | } | 79 | } |
89 | } | 80 | } |
90 | 81 | ||
91 | impl DiagnosticWithFix for MissingFields { | ||
92 | type AST = ast::RecordExpr; | ||
93 | |||
94 | fn fix_source(&self, db: &dyn AstDatabase) -> Option<Self::AST> { | ||
95 | let root = db.parse_or_expand(self.file)?; | ||
96 | Some(self.field_list_parent.to_node(&root)) | ||
97 | } | ||
98 | } | ||
99 | |||
100 | #[derive(Debug)] | 82 | #[derive(Debug)] |
101 | pub struct MissingPatFields { | 83 | pub struct MissingPatFields { |
102 | pub file: HirFileId, | 84 | pub file: HirFileId, |
@@ -163,15 +145,6 @@ impl Diagnostic for MissingOkInTailExpr { | |||
163 | } | 145 | } |
164 | } | 146 | } |
165 | 147 | ||
166 | impl DiagnosticWithFix for MissingOkInTailExpr { | ||
167 | type AST = ast::Expr; | ||
168 | |||
169 | fn fix_source(&self, db: &dyn AstDatabase) -> Option<Self::AST> { | ||
170 | let root = db.parse_or_expand(self.file)?; | ||
171 | Some(self.expr.to_node(&root)) | ||
172 | } | ||
173 | } | ||
174 | |||
175 | #[derive(Debug)] | 148 | #[derive(Debug)] |
176 | pub struct BreakOutsideOfLoop { | 149 | pub struct BreakOutsideOfLoop { |
177 | pub file: HirFileId, | 150 | pub file: HirFileId, |