diff options
Diffstat (limited to 'crates/hir/src/diagnostics.rs')
-rw-r--r-- | crates/hir/src/diagnostics.rs | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs index 26dbcd86a..8a7c3a4fd 100644 --- a/crates/hir/src/diagnostics.rs +++ b/crates/hir/src/diagnostics.rs | |||
@@ -11,9 +11,8 @@ use hir_expand::{name::Name, HirFileId, InFile}; | |||
11 | use stdx::format_to; | 11 | use stdx::format_to; |
12 | use syntax::{ast, AstPtr, SyntaxNodePtr, TextRange}; | 12 | use syntax::{ast, AstPtr, SyntaxNodePtr, TextRange}; |
13 | 13 | ||
14 | pub use hir_ty::{ | 14 | pub use crate::diagnostics_sink::{ |
15 | diagnostics::IncorrectCase, | 15 | Diagnostic, DiagnosticCode, DiagnosticSink, DiagnosticSinkBuilder, |
16 | diagnostics_sink::{Diagnostic, DiagnosticCode, DiagnosticSink, DiagnosticSinkBuilder}, | ||
17 | }; | 16 | }; |
18 | 17 | ||
19 | // Diagnostic: unresolved-module | 18 | // Diagnostic: unresolved-module |
@@ -578,3 +577,33 @@ impl Diagnostic for InternalBailedOut { | |||
578 | self | 577 | self |
579 | } | 578 | } |
580 | } | 579 | } |
580 | |||
581 | pub use hir_ty::diagnostics::IncorrectCase; | ||
582 | |||
583 | impl Diagnostic for IncorrectCase { | ||
584 | fn code(&self) -> DiagnosticCode { | ||
585 | DiagnosticCode("incorrect-ident-case") | ||
586 | } | ||
587 | |||
588 | fn message(&self) -> String { | ||
589 | format!( | ||
590 | "{} `{}` should have {} name, e.g. `{}`", | ||
591 | self.ident_type, | ||
592 | self.ident_text, | ||
593 | self.expected_case.to_string(), | ||
594 | self.suggested_text | ||
595 | ) | ||
596 | } | ||
597 | |||
598 | fn display_source(&self) -> InFile<SyntaxNodePtr> { | ||
599 | InFile::new(self.file, self.ident.clone().into()) | ||
600 | } | ||
601 | |||
602 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | ||
603 | self | ||
604 | } | ||
605 | |||
606 | fn is_experimental(&self) -> bool { | ||
607 | true | ||
608 | } | ||
609 | } | ||