1--- a/src/shared/discriminant_assigner.rs
2+++ b/src/shared/discriminant_assigner.rs
3@@ -26,20 +26,20 @@
4         let discriminant_expr = &discriminant.1;
5         let variant_name = &variant.ident;
6
7-        let Expr::Lit(ExprLit { lit: Lit::Int(int), .. }) = discriminant_expr else {
8+        if let Expr::Lit(ExprLit { lit: Lit::Int(int), .. }) = discriminant_expr {
9+            let discriminant_value: u128 = int.base10_parse().unwrap_or_else(unreachable);
10+            if discriminant_value > self.max_value() {
11+                abort!(variant, "Value of variant exceeds the given number of bits")
12+            }
13+
14+            Some(discriminant_value)
15+        } else {
16             abort!(
17                 discriminant_expr,
18                 "variant `{}` is not a number", variant_name;
19                 help = "only literal integers currently supported"
20             )
21-        };
22-
23-        let discriminant_value: u128 = int.base10_parse().unwrap_or_else(unreachable);
24-        if discriminant_value > self.max_value() {
25-            abort!(variant, "Value of variant exceeds the given number of bits")
26         }
27-
28-        Some(discriminant_value)
29     }
30
31     fn assign(&mut self, variant: &Variant) -> u128 {
32--- a/src/shared/fallback.rs
33+++ b/src/shared/fallback.rs
34@@ -22,8 +22,9 @@
35             }
36             Unnamed(fields) => {
37                 let variant_fields = fields.unnamed.iter();
38-                let Ok(fallback_value) = variant_fields.exactly_one() else {
39-                    abort!(variant, "fallback variant must have exactly one field"; help = "use only one field or change to a unit variant")
40+                let fallback_value = match variant_fields.exactly_one() {
41+                    Ok(ok) => ok,
42+                    _ => abort!(variant, "fallback variant must have exactly one field"; help = "use only one field or change to a unit variant")
43                 };
44
45                 if !is_last_variant {
46