Add use for Unexpected

In preparation for running the formatter on `src/` and a function local
use statement for `$crate::serde:🇩🇪:Unexpected`, this shortens the
line of code that uses this type preventing the formatter for later
munging that line.
This commit is contained in:
Tobin C. Harding 2022-06-21 10:04:21 +10:00
parent fd217e72c3
commit 743b197124
1 changed files with 3 additions and 1 deletions

View File

@ -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));
}
}