internal: refactor incorrect case diagnostics

This commit is contained in:
Aleksey Kladov 2021-06-13 21:09:03 +03:00
parent 2ad7892462
commit fc30c5ccbe
6 changed files with 46 additions and 76 deletions

View file

@ -34,6 +34,7 @@ macro_rules! diagnostics {
diagnostics![
BreakOutsideOfLoop,
InactiveCode,
IncorrectCase,
MacroError,
MismatchedArgCount,
MissingFields,
@ -195,31 +196,3 @@ impl Diagnostic for InternalBailedOut {
}
pub use hir_ty::diagnostics::IncorrectCase;
impl Diagnostic for IncorrectCase {
fn code(&self) -> DiagnosticCode {
DiagnosticCode("incorrect-ident-case")
}
fn message(&self) -> String {
format!(
"{} `{}` should have {} name, e.g. `{}`",
self.ident_type,
self.ident_text,
self.expected_case.to_string(),
self.suggested_text
)
}
fn display_source(&self) -> InFile<SyntaxNodePtr> {
InFile::new(self.file, self.ident.clone().into())
}
fn as_any(&self) -> &(dyn Any + Send + 'static) {
self
}
fn is_experimental(&self) -> bool {
true
}
}