Skip to content

Commit

Permalink
Add use for Unexpected
Browse files Browse the repository at this point in the history
In preparation for running the formatter on `src/` and a function local
use statement for `$crate::serde::de::Unexpected`, this shortens the
line of code that uses this type preventing the formatter for later
munging that line.
  • Loading branch information
tcharding committed Jul 13, 2022
1 parent a0b228d commit 7a5660d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/internal_macros.rs
Expand Up @@ -431,10 +431,12 @@ macro_rules! impl_bytes_newtype {
where
E: $crate::serde::de::Error,
{
use $crate::serde::de::Unexpected;

if let Ok(hex) = core::str::from_utf8(v) {
$crate::hashes::hex::FromHex::from_hex(hex).map_err(E::custom)
} else {
return Err(E::invalid_value($crate::serde::de::Unexpected::Bytes(v), &self));
return Err(E::invalid_value(Unexpected::Bytes(v), &self));
}
}

Expand Down

0 comments on commit 7a5660d

Please sign in to comment.