prevent ice when threshold is 0 and enum has no variants
This commit is contained in:
parent
33f084ef78
commit
f3a27d20f6
@ -167,7 +167,10 @@ fn check_variant(cx: &LateContext<'_>, threshold: u64, def: &EnumDef<'_>, item_n
|
||||
return;
|
||||
}
|
||||
|
||||
let first = &def.variants[0].ident.name.as_str();
|
||||
let first = match &def.variants.get(0) {
|
||||
Some(variant) => variant.ident.name.as_str(),
|
||||
None => return,
|
||||
};
|
||||
let mut pre = camel_case_split(first);
|
||||
let mut post = pre.clone();
|
||||
post.reverse();
|
||||
|
Loading…
Reference in New Issue
Block a user