diff --git a/src/proto/body.rs b/src/proto/body.rs index 7503ee4cc4..27fb34ec78 100644 --- a/src/proto/body.rs +++ b/src/proto/body.rs @@ -98,10 +98,9 @@ impl From<&'static [u8]> for Body { impl From> for Body { #[inline] fn from (cow: Cow<'static, [u8]>) -> Body { - if let Cow::Borrowed(value) = cow { - Body::from(value) - } else { - Body::from(cow.to_owned()) + match cow { + Cow::Borrowed(b) => Body::from(b), + Cow::Owned(o) => Body::from(o) } } } @@ -123,10 +122,9 @@ impl From<&'static str> for Body { impl From> for Body { #[inline] fn from(cow: Cow<'static, str>) -> Body { - if let Cow::Borrowed(value) = cow { - Body::from(value) - } else { - Body::from(cow.to_owned()) + match cow { + Cow::Borrowed(b) => Body::from(b), + Cow::Owned(o) => Body::from(o) } } }