mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
let upper_case_acronyms check the enum name
Signed-off-by: TennyZhuang <zty0826@gmail.com>
This commit is contained in:
parent
2be6c4ae5b
commit
bf18768219
3 changed files with 23 additions and 1 deletions
|
@ -114,6 +114,7 @@ impl LateLintPass<'_> for UpperCaseAcronyms {
|
||||||
check_ident(cx, &it.ident, self.upper_case_acronyms_aggressive);
|
check_ident(cx, &it.ident, self.upper_case_acronyms_aggressive);
|
||||||
},
|
},
|
||||||
ItemKind::Enum(ref enumdef, _) => {
|
ItemKind::Enum(ref enumdef, _) => {
|
||||||
|
check_ident(cx, &it.ident, self.upper_case_acronyms_aggressive);
|
||||||
// check enum variants separately because again we only want to lint on private enums and
|
// check enum variants separately because again we only want to lint on private enums and
|
||||||
// the fn check_variant does not know about the vis of the enum of its variants
|
// the fn check_variant does not know about the vis of the enum of its variants
|
||||||
enumdef
|
enumdef
|
||||||
|
|
|
@ -38,4 +38,13 @@ enum ParseErrorPrivate<T> {
|
||||||
Parse(T, String),
|
Parse(T, String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// do lint here
|
||||||
|
struct JSON;
|
||||||
|
|
||||||
|
// do lint here
|
||||||
|
enum YAML {
|
||||||
|
Num(u32),
|
||||||
|
Str(String),
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -54,5 +54,17 @@ error: name `WASD` contains a capitalized acronym
|
||||||
LL | WASD(u8),
|
LL | WASD(u8),
|
||||||
| ^^^^ help: consider making the acronym lowercase, except the initial letter: `Wasd`
|
| ^^^^ help: consider making the acronym lowercase, except the initial letter: `Wasd`
|
||||||
|
|
||||||
error: aborting due to 9 previous errors
|
error: name `JSON` contains a capitalized acronym
|
||||||
|
--> $DIR/upper_case_acronyms.rs:42:8
|
||||||
|
|
|
||||||
|
LL | struct JSON;
|
||||||
|
| ^^^^ help: consider making the acronym lowercase, except the initial letter: `Json`
|
||||||
|
|
||||||
|
error: name `YAML` contains a capitalized acronym
|
||||||
|
--> $DIR/upper_case_acronyms.rs:45:6
|
||||||
|
|
|
||||||
|
LL | enum YAML {
|
||||||
|
| ^^^^ help: consider making the acronym lowercase, except the initial letter: `Yaml`
|
||||||
|
|
||||||
|
error: aborting due to 11 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue