Skip to content

Commit eeb5bfc

Browse files
committed
Cleanup decl_check
1 parent ac59584 commit eeb5bfc

File tree

4 files changed

+154
-164
lines changed

4 files changed

+154
-164
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/hir_ty/src/diagnostics.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,37 @@ impl fmt::Display for CaseType {
345345
}
346346
}
347347

348+
#[derive(Debug)]
349+
pub enum IdentType {
350+
Argument,
351+
Constant,
352+
Enum,
353+
Field,
354+
Function,
355+
StaticVariable,
356+
Structure,
357+
Variable,
358+
Variant,
359+
}
360+
361+
impl fmt::Display for IdentType {
362+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
363+
let repr = match self {
364+
IdentType::Argument => "Argument",
365+
IdentType::Constant => "Constant",
366+
IdentType::Enum => "Enum",
367+
IdentType::Field => "Field",
368+
IdentType::Function => "Function",
369+
IdentType::StaticVariable => "Static variable",
370+
IdentType::Structure => "Structure",
371+
IdentType::Variable => "Variable",
372+
IdentType::Variant => "Variant",
373+
};
374+
375+
write!(f, "{}", repr)
376+
}
377+
}
378+
348379
// Diagnostic: incorrect-ident-case
349380
//
350381
// 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 {
353384
pub file: HirFileId,
354385
pub ident: AstPtr<ast::Name>,
355386
pub expected_case: CaseType,
356-
pub ident_type: String,
387+
pub ident_type: IdentType,
357388
pub ident_text: String,
358389
pub suggested_text: String,
359390
}

0 commit comments

Comments
 (0)