Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup decl_check #7571

Merged
merged 1 commit into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 32 additions & 1 deletion crates/hir_ty/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand All @@ -353,7 +384,7 @@ pub struct IncorrectCase {
pub file: HirFileId,
pub ident: AstPtr<ast::Name>,
pub expected_case: CaseType,
pub ident_type: String,
pub ident_type: IdentType,
pub ident_text: String,
pub suggested_text: String,
}
Expand Down
Loading