Fix deserialize_with on a struct variant with one field

This commit is contained in:
David Tolnay
2018-04-12 23:44:53 -07:00
parent 9f38ca032e
commit 202c10147e
2 changed files with 28 additions and 12 deletions
+8
View File
@@ -2598,6 +2598,14 @@ fn wrap_deserialize_variant_with(
})
});
let unwrap_fn = match variant.style {
Style::Struct if variant.fields.len() == 1 => {
let field_ident = variant.fields[0].ident.unwrap();
quote!({
|__wrap| {
#this::#variant_ident { #field_ident: __wrap.value }
}
})
}
Style::Struct => {
let field_idents = variant
.fields