Fix several clippy warnings in components/hyper_serde (#31508)

This commit is contained in:
Mucha Naibei 2024-03-06 11:14:23 +03:00 committed by GitHub
parent 24a088d94c
commit 3a3e76a935
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -138,7 +138,7 @@ impl<T> De<T> {
/// Returns a new `De` wrapper /// Returns a new `De` wrapper
#[inline(always)] #[inline(always)]
pub fn new(v: T) -> Self { pub fn new(v: T) -> Self {
De { v: v } De { v }
} }
} }
@ -366,7 +366,7 @@ impl<'de> Deserialize<'de> for De<HeaderMap> {
for v in values.0.iter() { for v in values.0.iter() {
headers.append( headers.append(
HeaderName::from_str(&k).map_err(V::Error::custom)?, HeaderName::from_str(&k).map_err(V::Error::custom)?,
HeaderValue::from_bytes(&v).map_err(V::Error::custom)?, HeaderValue::from_bytes(v).map_err(V::Error::custom)?,
); );
} }
} }
@ -453,7 +453,7 @@ impl<'a> Serialize for Ser<'a, HeaderMap> {
&Value( &Value(
&values &values
.iter() .iter()
.map(|v| v.as_bytes().iter().cloned().collect()) .map(|v| v.as_bytes().to_vec())
.collect::<Vec<Vec<u8>>>(), .collect::<Vec<Vec<u8>>>(),
self.pretty, self.pretty,
), ),
@ -531,7 +531,7 @@ impl<'a> Serialize for Ser<'a, Mime> {
where where
S: Serializer, S: Serializer,
{ {
serializer.serialize_str(&self.v.to_string()) serializer.serialize_str(&self.v.as_ref())
} }
} }