aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r--crates/ra_hir_ty/src/diagnostics.rs31
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;
6use std::any::Any; 6use std::any::Any;
7 7
8use hir_def::DefWithBodyId; 8use hir_def::DefWithBodyId;
9use hir_expand::diagnostics::{Diagnostic, DiagnosticSink, DiagnosticWithFix}; 9use hir_expand::diagnostics::{Diagnostic, DiagnosticSink};
10use hir_expand::{db::AstDatabase, name::Name, HirFileId, InFile}; 10use hir_expand::{name::Name, HirFileId, InFile};
11use ra_prof::profile; 11use ra_prof::profile;
12use ra_syntax::{ast, AstPtr, SyntaxNodePtr}; 12use ra_syntax::{ast, AstPtr, SyntaxNodePtr};
13use stdx::format_to; 13use stdx::format_to;
@@ -46,15 +46,6 @@ impl Diagnostic for NoSuchField {
46 } 46 }
47} 47}
48 48
49impl 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)]
59pub struct MissingFields { 50pub struct MissingFields {
60 pub file: HirFileId, 51 pub file: HirFileId,
@@ -88,15 +79,6 @@ impl Diagnostic for MissingFields {
88 } 79 }
89} 80}
90 81
91impl 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)]
101pub struct MissingPatFields { 83pub struct MissingPatFields {
102 pub file: HirFileId, 84 pub file: HirFileId,
@@ -163,15 +145,6 @@ impl Diagnostic for MissingOkInTailExpr {
163 } 145 }
164} 146}
165 147
166impl 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)]
176pub struct BreakOutsideOfLoop { 149pub struct BreakOutsideOfLoop {
177 pub file: HirFileId, 150 pub file: HirFileId,