chore: replace manual impl of #[non_exhaustive] for InvalidHeaderName (#981)

This commit is contained in:
Paolo Barbolini
2024-08-29 05:43:23 +02:00
committed by GitHub
parent f7a1b790df
commit ca405040ae

View File

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