Simplify discriminant overflow check

This commit is contained in:
David Tolnay 2020-05-05 10:29:52 -07:00
parent a3f6407efa
commit 4301f3ca51
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -111,7 +111,7 @@ fn parse_enum(item: ItemEnum) -> Result<Api> {
));
}
}
if variant.discriminant.is_none() && prev_discriminant.unwrap_or(0) == u32::MAX {
if variant.discriminant.is_none() && prev_discriminant == Some(u32::MAX) {
let msg = format!("discriminant overflow on value after {}", u32::MAX);
return Err(Error::new_spanned(variant, msg));
}