From ca405040aef2e5eec2d450e0f4c54f4dfa577ecb Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Thu, 29 Aug 2024 05:43:23 +0200 Subject: [PATCH] chore: replace manual impl of #[non_exhaustive] for InvalidHeaderName (#981) --- src/message/header/mod.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/message/header/mod.rs b/src/message/header/mod.rs index efa5b56..12ac6e7 100644 --- a/src/message/header/mod.rs +++ b/src/message/header/mod.rs @@ -157,18 +157,9 @@ impl Display for Headers { /// A possible error when converting a `HeaderName` from another type. // comes from `http` crate #[allow(missing_copy_implementations)] -#[derive(Clone)] -pub struct InvalidHeaderName { - _priv: (), -} - -impl fmt::Debug for InvalidHeaderName { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("InvalidHeaderName") - // skip _priv noise - .finish() - } -} +#[derive(Debug, Clone)] +#[non_exhaustive] +pub struct InvalidHeaderName; impl fmt::Display for InvalidHeaderName { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -189,7 +180,7 @@ impl HeaderName { { Ok(Self(Cow::Owned(ascii))) } else { - Err(InvalidHeaderName { _priv: () }) + Err(InvalidHeaderName) } }