Unpack a layer of NewtypeStruct when content is newtype

This commit is contained in:
David Tolnay committed 2018-04-23 11:04:42 -07:00
1 parent f46a08b04e
commit bceda5fb18
2 files changed
+60 -2

No files matched your search

+12 -2
View File
@@ -1310,7 +1310,12 @@ mod content {
where
V: Visitor<'de>,
{
visitor.visit_newtype_struct(self)
match self.content {
Content::Newtype(v) => {
visitor.visit_newtype_struct(ContentDeserializer::new(*v))
}
_ => visitor.visit_newtype_struct(self),
}
}
fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error>
@@ -2001,7 +2006,12 @@ mod content {
where
V: Visitor<'de>,
{
visitor.visit_newtype_struct(self)
match *self.content {
Content::Newtype(ref v) => {
visitor.visit_newtype_struct(ContentRefDeserializer::new(v))
}
_ => visitor.visit_newtype_struct(self),
}
}
fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error>