deserialize tuple enums with single element directly as the value instead of a sequence

This commit is contained in:
Oliver Schneider
2015-07-14 11:12:01 +02:00
committed by Oliver Schneider
parent 447d08bd91
commit 5885111863
4 changed files with 91 additions and 87 deletions
+6
View File
@@ -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,