Remove a layer of wrapping in deserialize_with untagged newtype variant
This commit is contained in:
parent
0e1d065402
commit
adb1c9540d
@ -1694,9 +1694,9 @@ fn deserialize_untagged_newtype_variant(
|
|||||||
deserializer: &Tokens,
|
deserializer: &Tokens,
|
||||||
) -> Fragment {
|
) -> Fragment {
|
||||||
let this = ¶ms.this;
|
let this = ¶ms.this;
|
||||||
|
let field_ty = field.ty;
|
||||||
match field.attrs.deserialize_with() {
|
match field.attrs.deserialize_with() {
|
||||||
None => {
|
None => {
|
||||||
let field_ty = &field.ty;
|
|
||||||
quote_expr! {
|
quote_expr! {
|
||||||
_serde::export::Result::map(
|
_serde::export::Result::map(
|
||||||
<#field_ty as _serde::Deserialize>::deserialize(#deserializer),
|
<#field_ty as _serde::Deserialize>::deserialize(#deserializer),
|
||||||
@ -1704,12 +1704,11 @@ fn deserialize_untagged_newtype_variant(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(path) => {
|
Some(path) => {
|
||||||
let (wrapper, wrapper_ty) = wrap_deserialize_field_with(params, field.ty, path);
|
|
||||||
quote_block! {
|
quote_block! {
|
||||||
#wrapper
|
let __value: #field_ty = _serde::export::Result::map(
|
||||||
_serde::export::Result::map(
|
#path(#deserializer),
|
||||||
<#wrapper_ty as _serde::Deserialize>::deserialize(#deserializer),
|
#this::#variant_ident);
|
||||||
|__wrapper| #this::#variant_ident(__wrapper.value))
|
__value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user