From 743b197124d77dc667b09cd6a949add4dc437263 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 21 Jun 2022 10:04:21 +1000 Subject: [PATCH] Add use for Unexpected 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. --- src/internal_macros.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/internal_macros.rs b/src/internal_macros.rs index c05f2f2a..e4a834fb 100644 --- a/src/internal_macros.rs +++ b/src/internal_macros.rs @@ -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)); } }