Skip to content

Commit

Permalink
Clippy suggests adding some lifetime annotations and removing some ot…
Browse files Browse the repository at this point in the history
…hers
  • Loading branch information
Rafael Bachmann committed Nov 21, 2024
1 parent 7e09b53 commit 54e159e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions source/postcard/src/de/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl<'a, 'b: 'a, F: Flavor<'b>> serde::de::MapAccess<'b> for MapAccess<'a, 'b, F
}
}

impl<'de, 'a, F: Flavor<'de>> de::Deserializer<'de> for &'a mut Deserializer<'de, F> {
impl<'de, F: Flavor<'de>> de::Deserializer<'de> for &mut Deserializer<'de, F> {
type Error = Error;

#[inline]
Expand Down Expand Up @@ -539,7 +539,7 @@ impl<'de, 'a, F: Flavor<'de>> de::Deserializer<'de> for &'a mut Deserializer<'de
}
}

impl<'de, 'a, F: Flavor<'de>> serde::de::VariantAccess<'de> for &'a mut Deserializer<'de, F> {
impl<'de, F: Flavor<'de>> serde::de::VariantAccess<'de> for &mut Deserializer<'de, F> {
type Error = Error;

#[inline]
Expand Down Expand Up @@ -567,7 +567,7 @@ impl<'de, 'a, F: Flavor<'de>> serde::de::VariantAccess<'de> for &'a mut Deserial
}
}

impl<'de, 'a, F: Flavor<'de>> serde::de::EnumAccess<'de> for &'a mut Deserializer<'de, F> {
impl<'de, F: Flavor<'de>> serde::de::EnumAccess<'de> for &mut Deserializer<'de, F> {
type Error = Error;
type Variant = Self;

Expand Down
4 changes: 2 additions & 2 deletions source/postcard/src/ser/flavors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl<'a> Flavor for Slice<'a> {
}
}

impl<'a> Index<usize> for Slice<'a> {
impl Index<usize> for Slice<'_> {
type Output = u8;

fn index(&self, idx: usize) -> &u8 {
Expand All @@ -204,7 +204,7 @@ impl<'a> Index<usize> for Slice<'a> {
}
}

impl<'a> IndexMut<usize> for Slice<'a> {
impl IndexMut<usize> for Slice<'_> {
fn index_mut(&mut self, idx: usize) -> &mut u8 {
let len = (self.end as usize) - (self.start as usize);
assert!(idx < len);
Expand Down
20 changes: 10 additions & 10 deletions source/postcard/src/ser/serializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl<F: Flavor> Serializer<F> {
}
}

impl<'a, F> ser::Serializer for &'a mut Serializer<F>
impl<F> ser::Serializer for &mut Serializer<F>
where
F: Flavor,
{
Expand Down Expand Up @@ -347,7 +347,7 @@ where
}
impl Write for CountWriter {
fn write_str(&mut self, s: &str) -> core::result::Result<(), core::fmt::Error> {
self.ct += s.as_bytes().len();
self.ct += s.len();
Ok(())
}
}
Expand All @@ -367,7 +367,7 @@ where
{
output: &'a mut IF,
}
impl<'a, IF> Write for FmtWriter<'a, IF>
impl<IF> Write for FmtWriter<'_, IF>
where
IF: Flavor,
{
Expand All @@ -388,7 +388,7 @@ where
}
}

impl<'a, F> ser::SerializeSeq for &'a mut Serializer<F>
impl<F> ser::SerializeSeq for &mut Serializer<F>
where
F: Flavor,
{
Expand All @@ -413,7 +413,7 @@ where
}
}

impl<'a, F> ser::SerializeTuple for &'a mut Serializer<F>
impl<F> ser::SerializeTuple for &mut Serializer<F>
where
F: Flavor,
{
Expand All @@ -434,7 +434,7 @@ where
}
}

impl<'a, F> ser::SerializeTupleStruct for &'a mut Serializer<F>
impl<F> ser::SerializeTupleStruct for &mut Serializer<F>
where
F: Flavor,
{
Expand All @@ -455,7 +455,7 @@ where
}
}

impl<'a, F> ser::SerializeTupleVariant for &'a mut Serializer<F>
impl<F> ser::SerializeTupleVariant for &mut Serializer<F>
where
F: Flavor,
{
Expand All @@ -476,7 +476,7 @@ where
}
}

impl<'a, F> ser::SerializeMap for &'a mut Serializer<F>
impl<F> ser::SerializeMap for &mut Serializer<F>
where
F: Flavor,
{
Expand Down Expand Up @@ -505,7 +505,7 @@ where
}
}

impl<'a, F> ser::SerializeStruct for &'a mut Serializer<F>
impl<F> ser::SerializeStruct for &mut Serializer<F>
where
F: Flavor,
{
Expand All @@ -526,7 +526,7 @@ where
}
}

impl<'a, F> ser::SerializeStructVariant for &'a mut Serializer<F>
impl<F> ser::SerializeStructVariant for &mut Serializer<F>
where
F: Flavor,
{
Expand Down

0 comments on commit 54e159e

Please sign in to comment.