From eeb5bfcfab1c41e3ad80b9e8ce69d2865c42abc6 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 5 Feb 2021 16:09:45 +0100 Subject: Cleanup decl_check --- crates/hir_ty/src/diagnostics.rs | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'crates/hir_ty/src/diagnostics.rs') diff --git a/crates/hir_ty/src/diagnostics.rs b/crates/hir_ty/src/diagnostics.rs index 323c5f963..08483760c 100644 --- a/crates/hir_ty/src/diagnostics.rs +++ b/crates/hir_ty/src/diagnostics.rs @@ -345,6 +345,37 @@ impl fmt::Display for CaseType { } } +#[derive(Debug)] +pub enum IdentType { + Argument, + Constant, + Enum, + Field, + Function, + StaticVariable, + Structure, + Variable, + Variant, +} + +impl fmt::Display for IdentType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let repr = match self { + IdentType::Argument => "Argument", + IdentType::Constant => "Constant", + IdentType::Enum => "Enum", + IdentType::Field => "Field", + IdentType::Function => "Function", + IdentType::StaticVariable => "Static variable", + IdentType::Structure => "Structure", + IdentType::Variable => "Variable", + IdentType::Variant => "Variant", + }; + + write!(f, "{}", repr) + } +} + // Diagnostic: incorrect-ident-case // // This diagnostic is triggered if an item name doesn't follow https://doc.rust-lang.org/1.0.0/style/style/naming/README.html[Rust naming convention]. @@ -353,7 +384,7 @@ pub struct IncorrectCase { pub file: HirFileId, pub ident: AstPtr, pub expected_case: CaseType, - pub ident_type: String, + pub ident_type: IdentType, pub ident_text: String, pub suggested_text: String, } -- cgit v1.2.3