diff --git a/tests/test_error.rs b/tests/test_error.rs index 6439bd42..f0fc45cf 100644 --- a/tests/test_error.rs +++ b/tests/test_error.rs @@ -404,31 +404,31 @@ fn test_billion_laughs() { #[derive(Debug)] struct X; + impl<'de> Visitor<'de> for X { + type Value = X; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("exponential blowup") + } + + fn visit_unit(self) -> Result { + Ok(X) + } + + fn visit_seq(self, mut seq: S) -> Result + where + S: SeqAccess<'de>, + { + while let Some(X) = seq.next_element()? {} + Ok(X) + } + } + impl<'de> Deserialize<'de> for X { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { - impl<'de> Visitor<'de> for X { - type Value = X; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("exponential blowup") - } - - fn visit_unit(self) -> Result { - Ok(X) - } - - fn visit_seq(self, mut seq: S) -> Result - where - S: SeqAccess<'de>, - { - while let Some(X) = seq.next_element()? {} - Ok(X) - } - } - deserializer.deserialize_any(X) } }