diff options
author | ivan770 <[email protected]> | 2020-12-08 18:47:20 +0000 |
---|---|---|
committer | ivan770 <[email protected]> | 2020-12-08 18:47:20 +0000 |
commit | cb66bb8ff9609d4fc3702ac1ed6197802b54e473 (patch) | |
tree | bebe4b12adb6916a5a5eefdc50be523028368987 /crates/hir_ty/src/diagnostics.rs | |
parent | e2e6b709e60f22279b755ceae74e579520c9ae3b (diff) |
Remove this semicolon
Diffstat (limited to 'crates/hir_ty/src/diagnostics.rs')
-rw-r--r-- | crates/hir_ty/src/diagnostics.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/hir_ty/src/diagnostics.rs b/crates/hir_ty/src/diagnostics.rs index b58fe0ed7..e59487e54 100644 --- a/crates/hir_ty/src/diagnostics.rs +++ b/crates/hir_ty/src/diagnostics.rs | |||
@@ -216,6 +216,30 @@ impl Diagnostic for MissingOkInTailExpr { | |||
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | #[derive(Debug)] | ||
220 | pub struct RemoveThisSemicolon { | ||
221 | pub file: HirFileId, | ||
222 | pub expr: AstPtr<ast::Expr>, | ||
223 | } | ||
224 | |||
225 | impl Diagnostic for RemoveThisSemicolon { | ||
226 | fn code(&self) -> DiagnosticCode { | ||
227 | DiagnosticCode("remove-this-semicolon") | ||
228 | } | ||
229 | |||
230 | fn message(&self) -> String { | ||
231 | "Remove this semicolon".to_string() | ||
232 | } | ||
233 | |||
234 | fn display_source(&self) -> InFile<SyntaxNodePtr> { | ||
235 | InFile { file_id: self.file, value: self.expr.clone().into() } | ||
236 | } | ||
237 | |||
238 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | ||
239 | self | ||
240 | } | ||
241 | } | ||
242 | |||
219 | // Diagnostic: break-outside-of-loop | 243 | // Diagnostic: break-outside-of-loop |
220 | // | 244 | // |
221 | // This diagnostic is triggered if `break` keyword is used outside of a loop. | 245 | // This diagnostic is triggered if `break` keyword is used outside of a loop. |