Remove `visit_bytes` implementation from `FromStrVisitor`

This visitor is meant to deserialize strings using `FromStr` not
bytes.
This commit is contained in:
Thomas Eizinger 2021-01-13 09:57:09 +11:00
parent e6e23e9dd6
commit c2fd5cefa4
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
1 changed files with 0 additions and 8 deletions

View File

@ -29,14 +29,6 @@ where
formatter.write_str(self.expectation) formatter.write_str(self.expectation)
} }
fn visit_bytes<E: de::Error>(self, v: &[u8]) -> Result<Self::Value, E> {
if let Ok(hex) = str::from_utf8(v) {
FromStr::from_str(hex).map_err(E::custom)
} else {
Err(E::invalid_value(de::Unexpected::Bytes(v), &self))
}
}
fn visit_str<E: de::Error>(self, v: &str) -> Result<Self::Value, E> { fn visit_str<E: de::Error>(self, v: &str) -> Result<Self::Value, E> {
FromStr::from_str(v).map_err(E::custom) FromStr::from_str(v).map_err(E::custom)
} }