mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-22 21:48:02 +00:00
deserialize tuple enums with single element directly as the value instead of a sequence
This commit is contained in:
committed by
Oliver Schneider
parent
447d08bd91
commit
5885111863
@@ -555,6 +555,12 @@ fn deserialize_variant(
|
||||
Ok($type_ident::$variant_ident)
|
||||
})
|
||||
}
|
||||
ast::TupleVariantKind(ref args) if args.len() == 1 => {
|
||||
quote_expr!(cx, {
|
||||
let val = try!(visitor.visit_simple());
|
||||
Ok($type_ident::$variant_ident(val))
|
||||
})
|
||||
}
|
||||
ast::TupleVariantKind(ref args) => {
|
||||
deserialize_tuple_variant(
|
||||
cx,
|
||||
|
||||
Reference in New Issue
Block a user