xml: Fix serialization of unit variants

This commit is contained in:
Lennart
2024-12-28 13:14:14 +01:00
parent 7e74610b75
commit ee21e5a23e

View File

@@ -199,8 +199,12 @@ impl Variant {
} }
Fields::Unit => { Fields::Unit => {
quote! { quote! {
if let Self::#ident = self { if let Self::#ident = &self {
::rustical_xml::XmlSerialize::serialize(&(), ns, tag, writer)?; if !enum_untagged {
::rustical_xml::XmlSerialize::serialize(&(), None, Some(#variant_name), writer)?;
} else {
::rustical_xml::XmlSerialize::serialize(&(), None, None, writer)?;
};
} }
} }
} }