Remove confusing call to deserialize_untagged_variant in deserialize_internally_tagged_variant

deserialize_untagged_variant in that place is called when deserialzie_with attribute is set.
In that case it performs special actions that is better to use explicitly in deserialize_untagged_variant
for readability
This commit is contained in:
Mingun 2024-08-11 02:06:52 +05:00
parent 1799547846
commit 15be2a600a

View File

@ -1868,8 +1868,11 @@ fn deserialize_internally_tagged_variant(
cattrs: &attr::Container,
deserializer: TokenStream,
) -> Fragment {
if variant.attrs.deserialize_with().is_some() {
return deserialize_untagged_variant(params, variant, cattrs, deserializer);
if let Some(path) = variant.attrs.deserialize_with() {
let unwrap_fn = unwrap_to_variant_closure(params, variant, false);
return quote_block! {
_serde::#private::Result::map(#path(#deserializer), #unwrap_fn)
};
}
let variant_ident = &variant.ident;