Skip to content

Commit c4488c9

Browse files
committed
fix(stackable-versioned): Correctly emit empty named field variants
1 parent 2b53a9d commit c4488c9

File tree

3 files changed

+30
-41
lines changed

3 files changed

+30
-41
lines changed

crates/stackable-versioned-macros/src/codegen/item/variant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ impl VersionedVariant {
193193
match &self.fields {
194194
Fields::Named(fields_named) => {
195195
let fields = Self::named_field_idents(fields_named);
196-
Some(quote! { { #(#fields)*: #(#fields.into()),* } })
196+
Some(quote! { { #(#fields:)* #(#fields.into()),* } })
197197
}
198198
Fields::Unnamed(fields_unnamed) => {
199199
let fields = Self::unnamed_field_ident(fields_unnamed);

crates/stackable-versioned-macros/tests/inputs/pass/enum_fields.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ use stackable_versioned::versioned;
33
#[versioned(version(name = "v1alpha1"), version(name = "v1alpha2"))]
44
// ---
55
pub mod versioned {
6-
enum MyEnum {
6+
enum Foo {
77
A { aa: usize },
88
B { bb: bool },
99
}
1010

11-
enum Bla {
11+
enum Bar {
1212
A(A),
13+
B {},
1314
}
1415

1516
struct A {}

crates/stackable-versioned-macros/tests/snapshots/stackable_versioned_macros__snapshots__pass@enum_fields.rs.snap

Lines changed: 26 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)