fix: break from the loop after matching enum variant

This commit is contained in:
lifichi 2022-08-14 23:04:02 +02:00 committed by GitHub
parent efdab555e1
commit 37b0ae263b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,6 +112,7 @@ fn parse_variant(variant: &syn::Variant, name: &Ident) -> Option<TokenStream> {
Fields::Unit => Some(quote! { Fields::Unit => Some(quote! {
#xml_element_name => { #xml_element_name => {
enum_value = ::std::option::Option::Some(#variant_name); enum_value = ::std::option::Option::Some(#variant_name);
break;
} }
}), }),
Fields::Unnamed(ref fields) => { Fields::Unnamed(ref fields) => {