From 7e50e34522f8514d7b77a5c9d20e82f59d0c6109 Mon Sep 17 00:00:00 2001 From: Victor Koenders Date: Tue, 28 May 2024 10:08:59 +0200 Subject: [PATCH] Fixed new clippy warning --- src/features/serde/ser.rs | 56 +++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/src/features/serde/ser.rs b/src/features/serde/ser.rs index edb122d9..ed225017 100644 --- a/src/features/serde/ser.rs +++ b/src/features/serde/ser.rs @@ -167,9 +167,9 @@ where 0u8.encode(self.enc) } - fn serialize_some(mut self, value: &T) -> Result + fn serialize_some(mut self, value: &T) -> Result where - T: Serialize, + T: Serialize + ?Sized, { 1u8.encode(&mut self.enc)?; value.serialize(self) @@ -192,18 +192,18 @@ where variant_index.encode(self.enc) } - fn serialize_newtype_struct( + fn serialize_newtype_struct( self, _name: &'static str, value: &T, ) -> Result where - T: Serialize, + T: Serialize + ?Sized, { value.serialize(self) } - fn serialize_newtype_variant( + fn serialize_newtype_variant( mut self, _name: &'static str, variant_index: u32, @@ -211,7 +211,7 @@ where value: &T, ) -> Result where - T: Serialize, + T: Serialize + ?Sized, { variant_index.encode(&mut self.enc)?; value.serialize(self) @@ -272,9 +272,9 @@ where } #[cfg(not(feature = "alloc"))] - fn collect_str(self, _: &T) -> Result + fn collect_str(self, _: &T) -> Result where - T: core::fmt::Display, + T: core::fmt::Display + ?Sized, { Err(SerdeEncodeError::CannotCollectStr.into()) } @@ -290,9 +290,9 @@ impl<'a, ENC: Encoder> SerializeSeq for Compound<'a, ENC> { type Ok = (); type Error = EncodeError; - fn serialize_element(&mut self, value: &T) -> Result<(), Self::Error> + fn serialize_element(&mut self, value: &T) -> Result<(), Self::Error> where - T: Serialize, + T: Serialize + ?Sized, { value.serialize(SerdeEncoder { enc: self.enc }) } @@ -306,9 +306,9 @@ impl<'a, ENC: Encoder> SerializeTuple for Compound<'a, ENC> { type Ok = (); type Error = EncodeError; - fn serialize_element(&mut self, value: &T) -> Result<(), Self::Error> + fn serialize_element(&mut self, value: &T) -> Result<(), Self::Error> where - T: Serialize, + T: Serialize + ?Sized, { value.serialize(SerdeEncoder { enc: self.enc }) } @@ -322,9 +322,9 @@ impl<'a, ENC: Encoder> SerializeTupleStruct for Compound<'a, ENC> { type Ok = (); type Error = EncodeError; - fn serialize_field(&mut self, value: &T) -> Result<(), Self::Error> + fn serialize_field(&mut self, value: &T) -> Result<(), Self::Error> where - T: Serialize, + T: Serialize + ?Sized, { value.serialize(SerdeEncoder { enc: self.enc }) } @@ -338,9 +338,9 @@ impl<'a, ENC: Encoder> SerializeTupleVariant for Compound<'a, ENC> { type Ok = (); type Error = EncodeError; - fn serialize_field(&mut self, value: &T) -> Result<(), Self::Error> + fn serialize_field(&mut self, value: &T) -> Result<(), Self::Error> where - T: Serialize, + T: Serialize + ?Sized, { value.serialize(SerdeEncoder { enc: self.enc }) } @@ -354,16 +354,16 @@ impl<'a, ENC: Encoder> SerializeMap for Compound<'a, ENC> { type Ok = (); type Error = EncodeError; - fn serialize_key(&mut self, key: &T) -> Result<(), Self::Error> + fn serialize_key(&mut self, key: &T) -> Result<(), Self::Error> where - T: Serialize, + T: Serialize + ?Sized, { key.serialize(SerdeEncoder { enc: self.enc }) } - fn serialize_value(&mut self, value: &T) -> Result<(), Self::Error> + fn serialize_value(&mut self, value: &T) -> Result<(), Self::Error> where - T: Serialize, + T: Serialize + ?Sized, { value.serialize(SerdeEncoder { enc: self.enc }) } @@ -377,13 +377,9 @@ impl<'a, ENC: Encoder> SerializeStruct for Compound<'a, ENC> { type Ok = (); type Error = EncodeError; - fn serialize_field( - &mut self, - _key: &'static str, - value: &T, - ) -> Result<(), Self::Error> + fn serialize_field(&mut self, _key: &'static str, value: &T) -> Result<(), Self::Error> where - T: Serialize, + T: Serialize + ?Sized, { value.serialize(SerdeEncoder { enc: self.enc }) } @@ -397,13 +393,9 @@ impl<'a, ENC: Encoder> SerializeStructVariant for Compound<'a, ENC> { type Ok = (); type Error = EncodeError; - fn serialize_field( - &mut self, - _key: &'static str, - value: &T, - ) -> Result<(), Self::Error> + fn serialize_field(&mut self, _key: &'static str, value: &T) -> Result<(), Self::Error> where - T: Serialize, + T: Serialize + ?Sized, { value.serialize(SerdeEncoder { enc: self.enc }) }