From 433b0197bbf28cec7309f1a5c06b50496f1bf139 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 22 Nov 2022 21:39:56 -0800 Subject: [PATCH] Fix formatting --- instant-xml-macros/src/de.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/instant-xml-macros/src/de.rs b/instant-xml-macros/src/de.rs index 119e5f8..20fee2f 100644 --- a/instant-xml-macros/src/de.rs +++ b/instant-xml-macros/src/de.rs @@ -33,11 +33,11 @@ fn deserialize_enum( let mut variants = TokenStream::new(); for variant in data.variants.iter() { - let v_ident = &variant.ident; + let v_ident = &variant.ident; let meta = match VariantMeta::from_variant(variant, &meta) { - Ok(meta) => meta, - Err(err) => return err.to_compile_error() - }; + Ok(meta) => meta, + Err(err) => return err.to_compile_error() + }; let serialize_as = meta.serialize_as; variants.extend(quote!(Ok(#serialize_as) => Ok(#ident::#v_ident),)); @@ -48,16 +48,18 @@ fn deserialize_enum( let (_, ty_generics, where_clause) = input.generics.split_for_impl(); quote!( - impl #impl_generics FromXml<'xml> for #ident #ty_generics #where_clause { - fn deserialize<'cx>(deserializer: &'cx mut ::instant_xml::Deserializer<'cx, 'xml>) -> Result { - match deserializer.take_str() { - #variants - _ => Err(::instant_xml::Error::UnexpectedValue) - } - } + impl #impl_generics FromXml<'xml> for #ident #ty_generics #where_clause { + fn deserialize<'cx>( + deserializer: &'cx mut ::instant_xml::Deserializer<'cx, 'xml> + ) -> Result { + match deserializer.take_str() { + #variants + _ => Err(::instant_xml::Error::UnexpectedValue) + } + } const KIND: ::instant_xml::Kind = ::instant_xml::Kind::Scalar; - } + } ) }