enum_variant_names should ignore when all prefixes are _
This commit is contained in:
parent
93c6f9ebed
commit
ab645bb081
3 changed files with 53 additions and 2 deletions
|
|
@ -190,7 +190,7 @@ fn check_variant(cx: &LateContext<'_>, threshold: u64, def: &EnumDef<'_>, item_n
|
|||
.map(|e| *e.0)
|
||||
.collect();
|
||||
}
|
||||
let (what, value) = match (pre.is_empty(), post.is_empty()) {
|
||||
let (what, value) = match (have_no_extra_prefix(&pre), post.is_empty()) {
|
||||
(true, true) => return,
|
||||
(false, _) => ("pre", pre.join("")),
|
||||
(true, false) => {
|
||||
|
|
@ -212,6 +212,11 @@ fn check_variant(cx: &LateContext<'_>, threshold: u64, def: &EnumDef<'_>, item_n
|
|||
);
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn have_no_extra_prefix(prefixes: &Vec<&str>) -> bool {
|
||||
prefixes.is_empty() || prefixes.join("") == "_"
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn to_camel_case(item_name: &str) -> String {
|
||||
let mut s = String::new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue