Skip to content

Commit

Permalink
Merge pull request #792 from dtolnay/valuemapde
Browse files Browse the repository at this point in the history
Delete Deserializer impl from value::‍de::MapDeserializer
  • Loading branch information
dtolnay authored Aug 28, 2021
2 parents 6346bb3 + acfd0a7 commit ac9078e
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions src/value/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,7 @@ impl<'de> VariantAccess<'de> for VariantDeserializer {
V: Visitor<'de>,
{
match self.value {
Some(Value::Object(v)) => {
serde::Deserializer::deserialize_any(MapDeserializer::new(v), visitor)
}
Some(Value::Object(v)) => visitor.visit_map(MapDeserializer::new(v)),
Some(other) => Err(serde::de::Error::invalid_type(
other.unexpected(),
&"struct variant",
Expand Down Expand Up @@ -665,24 +663,6 @@ impl<'de> MapAccess<'de> for MapDeserializer {
}
}

impl<'de> serde::Deserializer<'de> for MapDeserializer {
type Error = Error;

#[inline]
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error>
where
V: Visitor<'de>,
{
visitor.visit_map(self)
}

forward_to_deserialize_any! {
bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string
bytes byte_buf option unit unit_struct newtype_struct seq tuple
tuple_struct map struct enum identifier ignored_any
}
}

macro_rules! deserialize_value_ref_number {
($method:ident) => {
#[cfg(not(feature = "arbitrary_precision"))]
Expand Down

0 comments on commit ac9078e

Please sign in to comment.