diff --git a/stabby-abi/Cargo.toml b/stabby-abi/Cargo.toml index f0fab61..0c74148 100644 --- a/stabby-abi/Cargo.toml +++ b/stabby-abi/Cargo.toml @@ -45,7 +45,7 @@ stabby-macros.workspace = true abi_stable = { workspace = true, optional = true } libc = { workspace = true, optional = true } rustversion = { workspace = true } -serde = { workspace = true, optional = true } +serde = { workspace = true, optional = true, features = ["derive"] } sha2-const-stable = { workspace = true } [dev-dependencies] diff --git a/stabby-abi/src/alloc/boxed.rs b/stabby-abi/src/alloc/boxed.rs index 0e1f0cf..d2f914a 100644 --- a/stabby-abi/src/alloc/boxed.rs +++ b/stabby-abi/src/alloc/boxed.rs @@ -439,12 +439,12 @@ mod serde_impl { use super::*; use crate::alloc::IAlloc; use serde::{Deserialize, Serialize}; - impl<'a, T: Serialize, Alloc: IAlloc> Serialize for BoxedSlice { + impl Serialize for BoxedSlice { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { - let slice: &[T] = &*self; + let slice: &[T] = self; slice.serialize(serializer) } } @@ -456,12 +456,12 @@ mod serde_impl { crate::alloc::vec::Vec::deserialize(deserializer).map(Into::into) } } - impl<'a, Alloc: IAlloc> Serialize for BoxedStr { + impl Serialize for BoxedStr { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { - let slice: &str = &*self; + let slice: &str = self; slice.serialize(serializer) } } diff --git a/stabby-abi/src/alloc/string.rs b/stabby-abi/src/alloc/string.rs index 66f1a6b..a0597b5 100644 --- a/stabby-abi/src/alloc/string.rs +++ b/stabby-abi/src/alloc/string.rs @@ -366,12 +366,12 @@ mod serde_impl { use super::*; use crate::alloc::IAlloc; use serde::{Deserialize, Serialize}; - impl<'a, Alloc: IAlloc> Serialize for String { + impl Serialize for String { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { - let slice: &str = &*self; + let slice: &str = self; slice.serialize(serializer) } } diff --git a/stabby-abi/src/alloc/sync.rs b/stabby-abi/src/alloc/sync.rs index b8ed3b0..21b3620 100644 --- a/stabby-abi/src/alloc/sync.rs +++ b/stabby-abi/src/alloc/sync.rs @@ -861,12 +861,12 @@ mod serde_impl { use super::*; use crate::alloc::IAlloc; use serde::{Deserialize, Serialize}; - impl<'a, T: Serialize, Alloc: IAlloc> Serialize for ArcSlice { + impl Serialize for ArcSlice { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { - let slice: &[T] = &*self; + let slice: &[T] = self; slice.serialize(serializer) } } @@ -878,12 +878,12 @@ mod serde_impl { crate::alloc::vec::Vec::deserialize(deserializer).map(Into::into) } } - impl<'a, Alloc: IAlloc> Serialize for ArcStr { + impl Serialize for ArcStr { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { - let slice: &str = &*self; + let slice: &str = self; slice.serialize(serializer) } } diff --git a/stabby-abi/src/alloc/vec.rs b/stabby-abi/src/alloc/vec.rs index cd40521..fc01145 100644 --- a/stabby-abi/src/alloc/vec.rs +++ b/stabby-abi/src/alloc/vec.rs @@ -824,12 +824,12 @@ mod serde_impl { use super::*; use crate::alloc::IAlloc; use serde::{de::Visitor, Deserialize, Serialize}; - impl<'a, T: Serialize, Alloc: IAlloc> Serialize for Vec { + impl Serialize for Vec { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { - let slice: &[T] = &*self; + let slice: &[T] = self; slice.serialize(serializer) } } diff --git a/stabby-abi/src/num.rs b/stabby-abi/src/num.rs index d8d9ed3..0ce9214 100644 --- a/stabby-abi/src/num.rs +++ b/stabby-abi/src/num.rs @@ -1,3 +1,4 @@ + /// Returned when using [`core::convert::TryInto`] on the illegal value of a restricted integer. #[crate::stabby] #[derive(Clone, Copy, Default, Debug, Ord, PartialEq, PartialOrd, Eq, Hash)] diff --git a/stabby-abi/src/result.rs b/stabby-abi/src/result.rs index 24e0768..f11e7a5 100644 --- a/stabby-abi/src/result.rs +++ b/stabby-abi/src/result.rs @@ -563,7 +563,7 @@ mod serde_impl { where S: serde::Serializer, { - let this: core::result::Result<_, _> = self.as_ref().into(); + let this: core::result::Result<_, _> = self.as_ref(); this.serialize(serializer) } } diff --git a/stabby-abi/src/slice.rs b/stabby-abi/src/slice.rs index 8a8d6c6..1b0bb2b 100644 --- a/stabby-abi/src/slice.rs +++ b/stabby-abi/src/slice.rs @@ -205,7 +205,7 @@ mod serde_impl { where S: serde::Serializer, { - let slice: &[T] = &*self; + let slice: &[T] = self; slice.serialize(serializer) } } @@ -214,7 +214,7 @@ mod serde_impl { where S: serde::Serializer, { - let slice: &[T] = &*self; + let slice: &[T] = self; slice.serialize(serializer) } } diff --git a/stabby-abi/src/str.rs b/stabby-abi/src/str.rs index 001d53c..47f9b77 100644 --- a/stabby-abi/src/str.rs +++ b/stabby-abi/src/str.rs @@ -53,7 +53,7 @@ impl<'a> From> for &'a str { } impl AsRef for Str<'_> { fn as_ref(&self) -> &str { - &*self + self } } impl<'a> Deref for Str<'a> { @@ -85,7 +85,7 @@ pub struct StrMut<'a> { } impl AsRef for StrMut<'_> { fn as_ref(&self) -> &str { - &*self + self } } impl<'a> Deref for StrMut<'a> { @@ -134,7 +134,7 @@ mod serde_impl { where S: serde::Serializer, { - serializer.serialize_str(&*self) + serializer.serialize_str(self) } } impl<'a> Serialize for StrMut<'a> { @@ -142,7 +142,7 @@ mod serde_impl { where S: serde::Serializer, { - serializer.serialize_str(&*self) + serializer.serialize_str(self) } } impl<'a> Deserialize<'a> for Str<'a> {