Remove this semicolon

This commit is contained in:
ivan770 2020-12-08 20:47:20 +02:00
parent e2e6b709e6
commit cb66bb8ff9
No known key found for this signature in database
GPG key ID: D8C4BD5AE4D9CC4D
5 changed files with 74 additions and 8 deletions

View file

@ -216,6 +216,30 @@ impl Diagnostic for MissingOkInTailExpr {
}
}
#[derive(Debug)]
pub struct RemoveThisSemicolon {
pub file: HirFileId,
pub expr: AstPtr<ast::Expr>,
}
impl Diagnostic for RemoveThisSemicolon {
fn code(&self) -> DiagnosticCode {
DiagnosticCode("remove-this-semicolon")
}
fn message(&self) -> String {
"Remove this semicolon".to_string()
}
fn display_source(&self) -> InFile<SyntaxNodePtr> {
InFile { file_id: self.file, value: self.expr.clone().into() }
}
fn as_any(&self) -> &(dyn Any + Send + 'static) {
self
}
}
// Diagnostic: break-outside-of-loop
//
// This diagnostic is triggered if `break` keyword is used outside of a loop.