File tree 1 file changed +12
-11
lines changed
1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -3521,20 +3521,11 @@ impl EnumBuilder {
3521
3521
None => variant_name,
3522
3522
} )
3523
3523
} ;
3524
- // Wrapping the unwrap in the const block ensures we get
3525
- // a compile-time panic.
3526
- let value = if let Some ( enum_ident) =
3527
- & self . result_error_enum_ident
3528
- {
3529
- quote ! { #enum_ident ( const { core:: num:: NonZero :: new( #expr) . unwrap( ) } ) }
3530
- } else {
3531
- quote ! { #rust_ty ( #expr ) }
3532
- } ;
3533
3524
3534
3525
enum_variants. push ( EnumVariantInfo {
3535
3526
variant_name : variant_ident,
3536
3527
variant_doc,
3537
- value,
3528
+ value : expr ,
3538
3529
} ) ;
3539
3530
3540
3531
self
@@ -3627,10 +3618,20 @@ impl EnumBuilder {
3627
3618
for ( variant_ident, variant_doc, variant_value) in
3628
3619
izip ! ( & variant_idents, & variant_docs, & variant_values)
3629
3620
{
3621
+ let value = if let Some ( enum_ident) =
3622
+ & self . result_error_enum_ident
3623
+ {
3624
+ // Wrapping the unwrap in the const block ensures we get
3625
+ // a compile-time panic.
3626
+ quote ! { #enum_ident ( const { core:: num:: NonZero :: new( #variant_value) . unwrap( ) } ) }
3627
+ } else {
3628
+ quote ! { #rust_ty( #variant_value) }
3629
+ } ;
3630
+
3630
3631
variants. push ( quote ! {
3631
3632
#variant_doc
3632
3633
#variant_guard
3633
- pub const #variant_ident: #enum_ident = #variant_value ;
3634
+ pub const #variant_ident: #enum_ident = #value ;
3634
3635
} ) ;
3635
3636
}
3636
3637
variants
You can’t perform that action at this time.
0 commit comments