Function, parameter or local binding is not named in snake_case
ID |
rust.maintainability.naming_identifier_style |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Naming |
Language |
Rust |
Description
Reports a function name, a first parameter name or a let binding that contains an uppercase letter, so it does not follow the snake_case convention Rust uses for values and functions.
Rationale
Rust reserves capitalisation for types, traits and enum variants, so a capital letter in a value name misleads the reader about what the identifier is - let Config = … reads as a type until it does not. Mixed conventions in one codebase also make identifiers harder to recall and to grep for.
The following code illustrates the pattern detected by this rule:
// FLAGGED: Function, parameter or local binding is not named in snake_case
pub fn parseInput(raw: &str) -> usize {
raw.len()
}