Skip to content

Commit

Permalink
fix: clippy warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Aug 6, 2024
1 parent 8e283b1 commit da86af3
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tasks/ast_codegen/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,15 @@ where
{
VariantDef {
name: variant.ident.to_string(),
discriminant: variant
.discriminant
.as_ref()
.map(|(_, disc)| match disc {
discriminant: variant.discriminant.as_ref().map_or_else(
|| panic!("expected explicit enum discriminants on {}", enum_dbg_name()),
|(_, disc)| match disc {
syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Int(lit), .. }) => {
lit.base10_parse().expect("invalid base10 enum discriminant")
}
_ => panic!("invalid enum discriminant {:?} on {}", disc, enum_dbg_name()),
})
.unwrap_or_else(|| {
panic!("expected explicit enum discriminants on {}", enum_dbg_name())
}),
},
),
fields: variant.fields.iter().map(|fi| lower_field(fi, ctx)).collect(),
markers: parse_inner_markers(&variant.attrs).unwrap(),
}
Expand Down

0 comments on commit da86af3

Please sign in to comment.