Struct, trait or type alias is not named in UpperCamelCase
ID |
rust.maintainability.naming_type |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Naming |
Language |
Rust |
Description
Reports a struct, trait or type-alias name that does not follow UpperCamelCase - it starts with a lowercase letter, or joins its words with underscores.
Rationale
Rust uses capitalisation to tell types apart from values at a glance, and the compiler leans on it too: a lowercase name in a pattern binds a new variable instead of matching a unit struct, so foo ⇒ … silently catches everything where Foo ⇒ … would have matched one case. A type that breaks the convention removes that cue.
The following code illustrates the pattern detected by this rule:
// FLAGGED: Struct, trait or type alias is not named in UpperCamelCase
pub struct http_request {
url: String,
}