Skip to content

Commit

Permalink
Remove visit_bytes implementation from FromStrVisitor
Browse files Browse the repository at this point in the history
This visitor is meant to deserialize strings using `FromStr` not
bytes.
  • Loading branch information
thomaseizinger committed Jan 12, 2021
1 parent e6e23e9 commit c2fd5ce
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/serde_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ where
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> {
FromStr::from_str(v).map_err(E::custom)
}
Expand Down

0 comments on commit c2fd5ce

Please sign in to comment.