Skip to content

Commit

Permalink
Fix lints around serde integration
Browse files Browse the repository at this point in the history
  • Loading branch information
p-avital committed Jun 26, 2024
1 parent 27676e7 commit 1999942
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion stabby-abi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions stabby-abi/src/alloc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, Alloc> {
impl<T: Serialize, Alloc: IAlloc> Serialize for BoxedSlice<T, Alloc> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let slice: &[T] = &*self;
let slice: &[T] = self;
slice.serialize(serializer)
}
}
Expand All @@ -456,12 +456,12 @@ mod serde_impl {
crate::alloc::vec::Vec::deserialize(deserializer).map(Into::into)
}
}
impl<'a, Alloc: IAlloc> Serialize for BoxedStr<Alloc> {
impl<Alloc: IAlloc> Serialize for BoxedStr<Alloc> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let slice: &str = &*self;
let slice: &str = self;
slice.serialize(serializer)
}
}
Expand Down
4 changes: 2 additions & 2 deletions stabby-abi/src/alloc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,12 @@ mod serde_impl {
use super::*;
use crate::alloc::IAlloc;
use serde::{Deserialize, Serialize};
impl<'a, Alloc: IAlloc> Serialize for String<Alloc> {
impl<Alloc: IAlloc> Serialize for String<Alloc> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let slice: &str = &*self;
let slice: &str = self;
slice.serialize(serializer)
}
}
Expand Down
8 changes: 4 additions & 4 deletions stabby-abi/src/alloc/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, Alloc> {
impl<T: Serialize, Alloc: IAlloc> Serialize for ArcSlice<T, Alloc> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let slice: &[T] = &*self;
let slice: &[T] = self;
slice.serialize(serializer)
}
}
Expand All @@ -878,12 +878,12 @@ mod serde_impl {
crate::alloc::vec::Vec::deserialize(deserializer).map(Into::into)
}
}
impl<'a, Alloc: IAlloc> Serialize for ArcStr<Alloc> {
impl<Alloc: IAlloc> Serialize for ArcStr<Alloc> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let slice: &str = &*self;
let slice: &str = self;
slice.serialize(serializer)
}
}
Expand Down
4 changes: 2 additions & 2 deletions stabby-abi/src/alloc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, Alloc> {
impl<T: Serialize, Alloc: IAlloc> Serialize for Vec<T, Alloc> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let slice: &[T] = &*self;
let slice: &[T] = self;
slice.serialize(serializer)
}
}
Expand Down
1 change: 1 addition & 0 deletions stabby-abi/src/num.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion stabby-abi/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
4 changes: 2 additions & 2 deletions stabby-abi/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ mod serde_impl {
where
S: serde::Serializer,
{
let slice: &[T] = &*self;
let slice: &[T] = self;
slice.serialize(serializer)
}
}
Expand All @@ -214,7 +214,7 @@ mod serde_impl {
where
S: serde::Serializer,
{
let slice: &[T] = &*self;
let slice: &[T] = self;
slice.serialize(serializer)
}
}
Expand Down
8 changes: 4 additions & 4 deletions stabby-abi/src/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<'a> From<Str<'a>> for &'a str {
}
impl AsRef<str> for Str<'_> {
fn as_ref(&self) -> &str {
&*self
self
}
}
impl<'a> Deref for Str<'a> {
Expand Down Expand Up @@ -85,7 +85,7 @@ pub struct StrMut<'a> {
}
impl AsRef<str> for StrMut<'_> {
fn as_ref(&self) -> &str {
&*self
self
}
}
impl<'a> Deref for StrMut<'a> {
Expand Down Expand Up @@ -134,15 +134,15 @@ mod serde_impl {
where
S: serde::Serializer,
{
serializer.serialize_str(&*self)
serializer.serialize_str(self)
}
}
impl<'a> Serialize for StrMut<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(&*self)
serializer.serialize_str(self)
}
}
impl<'a> Deserialize<'a> for Str<'a> {
Expand Down

0 comments on commit 1999942

Please sign in to comment.