mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
internal: refactor remove this semicolon diagnostics
This commit is contained in:
parent
8d391ec981
commit
74f3cca85a
8 changed files with 71 additions and 83 deletions
|
@ -39,6 +39,7 @@ diagnostics![
|
|||
MissingFields,
|
||||
MissingUnsafe,
|
||||
NoSuchField,
|
||||
RemoveThisSemicolon,
|
||||
UnimplementedBuiltinMacro,
|
||||
UnresolvedExternCrate,
|
||||
UnresolvedImport,
|
||||
|
@ -153,26 +154,7 @@ pub struct MismatchedArgCount {
|
|||
|
||||
#[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
|
||||
}
|
||||
pub expr: InFile<AstPtr<ast::Expr>>,
|
||||
}
|
||||
|
||||
// Diagnostic: missing-ok-or-some-in-tail-expr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue