diff options
author | Kirill Bulatov <[email protected]> | 2020-07-28 08:24:59 +0100 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-08-11 13:09:08 +0100 |
commit | cfbbd91a886e2394e7411f9d7f4966dcbd454764 (patch) | |
tree | baa61b0cd6e1b7424d7760402e1dafb21dc3fe72 /crates/ra_hir_ty | |
parent | 21184a1b2a4bea57a7666432749b171414136c60 (diff) |
Require source implementations for Diagnostic
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r-- | crates/ra_hir_ty/src/diagnostics.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs index 9d29f3071..efca09619 100644 --- a/crates/ra_hir_ty/src/diagnostics.rs +++ b/crates/ra_hir_ty/src/diagnostics.rs | |||
@@ -37,7 +37,7 @@ impl Diagnostic for NoSuchField { | |||
37 | "no such field".to_string() | 37 | "no such field".to_string() |
38 | } | 38 | } |
39 | 39 | ||
40 | fn fix_source(&self) -> InFile<SyntaxNodePtr> { | 40 | fn source(&self) -> InFile<SyntaxNodePtr> { |
41 | InFile::new(self.file, self.field.clone().into()) | 41 | InFile::new(self.file, self.field.clone().into()) |
42 | } | 42 | } |
43 | 43 | ||
@@ -137,7 +137,7 @@ impl Diagnostic for MissingMatchArms { | |||
137 | fn message(&self) -> String { | 137 | fn message(&self) -> String { |
138 | String::from("Missing match arm") | 138 | String::from("Missing match arm") |
139 | } | 139 | } |
140 | fn fix_source(&self) -> InFile<SyntaxNodePtr> { | 140 | fn source(&self) -> InFile<SyntaxNodePtr> { |
141 | InFile { file_id: self.file, value: self.match_expr.clone().into() } | 141 | InFile { file_id: self.file, value: self.match_expr.clone().into() } |
142 | } | 142 | } |
143 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | 143 | fn as_any(&self) -> &(dyn Any + Send + 'static) { |
@@ -155,7 +155,7 @@ impl Diagnostic for MissingOkInTailExpr { | |||
155 | fn message(&self) -> String { | 155 | fn message(&self) -> String { |
156 | "wrap return expression in Ok".to_string() | 156 | "wrap return expression in Ok".to_string() |
157 | } | 157 | } |
158 | fn fix_source(&self) -> InFile<SyntaxNodePtr> { | 158 | fn source(&self) -> InFile<SyntaxNodePtr> { |
159 | InFile { file_id: self.file, value: self.expr.clone().into() } | 159 | InFile { file_id: self.file, value: self.expr.clone().into() } |
160 | } | 160 | } |
161 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | 161 | fn as_any(&self) -> &(dyn Any + Send + 'static) { |
@@ -182,7 +182,7 @@ impl Diagnostic for BreakOutsideOfLoop { | |||
182 | fn message(&self) -> String { | 182 | fn message(&self) -> String { |
183 | "break outside of loop".to_string() | 183 | "break outside of loop".to_string() |
184 | } | 184 | } |
185 | fn fix_source(&self) -> InFile<SyntaxNodePtr> { | 185 | fn source(&self) -> InFile<SyntaxNodePtr> { |
186 | InFile { file_id: self.file, value: self.expr.clone().into() } | 186 | InFile { file_id: self.file, value: self.expr.clone().into() } |
187 | } | 187 | } |
188 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | 188 | fn as_any(&self) -> &(dyn Any + Send + 'static) { |
@@ -209,7 +209,7 @@ impl Diagnostic for MissingUnsafe { | |||
209 | fn message(&self) -> String { | 209 | fn message(&self) -> String { |
210 | format!("This operation is unsafe and requires an unsafe function or block") | 210 | format!("This operation is unsafe and requires an unsafe function or block") |
211 | } | 211 | } |
212 | fn fix_source(&self) -> InFile<SyntaxNodePtr> { | 212 | fn source(&self) -> InFile<SyntaxNodePtr> { |
213 | InFile { file_id: self.file, value: self.expr.clone().into() } | 213 | InFile { file_id: self.file, value: self.expr.clone().into() } |
214 | } | 214 | } |
215 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | 215 | fn as_any(&self) -> &(dyn Any + Send + 'static) { |
@@ -239,7 +239,7 @@ impl Diagnostic for MismatchedArgCount { | |||
239 | let s = if self.expected == 1 { "" } else { "s" }; | 239 | let s = if self.expected == 1 { "" } else { "s" }; |
240 | format!("Expected {} argument{}, found {}", self.expected, s, self.found) | 240 | format!("Expected {} argument{}, found {}", self.expected, s, self.found) |
241 | } | 241 | } |
242 | fn fix_source(&self) -> InFile<SyntaxNodePtr> { | 242 | fn source(&self) -> InFile<SyntaxNodePtr> { |
243 | InFile { file_id: self.file, value: self.call_expr.clone().into() } | 243 | InFile { file_id: self.file, value: self.call_expr.clone().into() } |
244 | } | 244 | } |
245 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | 245 | fn as_any(&self) -> &(dyn Any + Send + 'static) { |