From e0aab6fedc8024612ae048ec599d1797ed23796f Mon Sep 17 00:00:00 2001 From: Isabel Atkinson Date: Thu, 12 Dec 2024 11:51:52 -0500 Subject: [PATCH] minor: bump clippy version to 1.83.0 (#509) --- .evergreen/check-clippy.sh | 2 +- src/de/mod.rs | 2 +- src/de/raw.rs | 18 +++++++++--------- src/document.rs | 4 ++-- src/raw/array.rs | 4 ++-- src/raw/array_buf.rs | 2 +- src/raw/bson_ref.rs | 30 +++++++++++++++--------------- src/raw/document.rs | 4 ++-- src/raw/document_buf.rs | 2 +- src/raw/iter.rs | 6 +++--- src/raw/serde.rs | 10 +++++----- src/raw/serde/seeded_visitor.rs | 6 +++--- src/ser/raw/document_serializer.rs | 14 +++++++------- src/ser/raw/mod.rs | 6 +++--- src/ser/raw/value_serializer.rs | 6 +++--- src/tests/serde_helpers.rs | 2 +- src/tests/spec/corpus.rs | 2 +- 17 files changed, 60 insertions(+), 60 deletions(-) diff --git a/.evergreen/check-clippy.sh b/.evergreen/check-clippy.sh index c41008d5..c2925c75 100755 --- a/.evergreen/check-clippy.sh +++ b/.evergreen/check-clippy.sh @@ -5,7 +5,7 @@ set -o errexit . ~/.cargo/env # Pin clippy to the latest version. This should be updated when new versions of Rust are released. -CLIPPY_VERSION=1.80.0 +CLIPPY_VERSION=1.83.0 rustup install $CLIPPY_VERSION diff --git a/src/de/mod.rs b/src/de/mod.rs index 73c108d4..1ee8e5a4 100644 --- a/src/de/mod.rs +++ b/src/de/mod.rs @@ -91,7 +91,7 @@ where let de = Deserializer::new(bson); #[cfg(feature = "serde_path_to_error")] { - return serde_path_to_error::deserialize(de).map_err(Error::with_path); + serde_path_to_error::deserialize(de).map_err(Error::with_path) } #[cfg(not(feature = "serde_path_to_error"))] { diff --git a/src/de/raw.rs b/src/de/raw.rs index 58a2d2bc..e75b2b32 100644 --- a/src/de/raw.rs +++ b/src/de/raw.rs @@ -730,7 +730,7 @@ struct TimestampAccess<'d> { deserializer: &'d mut TimestampDeserializer, } -impl<'de, 'd> serde::de::MapAccess<'de> for TimestampAccess<'d> { +impl<'de> serde::de::MapAccess<'de> for TimestampAccess<'_> { type Error = Error; fn next_key_seed(&mut self, seed: K) -> Result> @@ -775,7 +775,7 @@ impl TimestampDeserializer { } } -impl<'de, 'a> serde::de::Deserializer<'de> for &'a mut TimestampDeserializer { +impl<'de> serde::de::Deserializer<'de> for &mut TimestampDeserializer { type Error = Error; fn deserialize_any(self, visitor: V) -> Result @@ -823,7 +823,7 @@ struct DateTimeAccess<'d> { deserializer: &'d mut DateTimeDeserializer, } -impl<'de, 'd> serde::de::MapAccess<'de> for DateTimeAccess<'d> { +impl<'de> serde::de::MapAccess<'de> for DateTimeAccess<'_> { type Error = Error; fn next_key_seed(&mut self, seed: K) -> Result> @@ -875,7 +875,7 @@ impl DateTimeDeserializer { } } -impl<'de, 'a> serde::de::Deserializer<'de> for &'a mut DateTimeDeserializer { +impl<'de> serde::de::Deserializer<'de> for &mut DateTimeDeserializer { type Error = Error; fn deserialize_any(self, visitor: V) -> Result @@ -932,7 +932,7 @@ struct BinaryAccess<'d, 'de> { deserializer: &'d mut BinaryDeserializer<'de>, } -impl<'de, 'd> serde::de::MapAccess<'de> for BinaryAccess<'d, 'de> { +impl<'de> serde::de::MapAccess<'de> for BinaryAccess<'_, 'de> { type Error = Error; fn next_key_seed(&mut self, seed: K) -> Result> @@ -976,7 +976,7 @@ impl<'a> BinaryDeserializer<'a> { } } -impl<'de, 'a> serde::de::Deserializer<'de> for &'a mut BinaryDeserializer<'de> { +impl<'de> serde::de::Deserializer<'de> for &mut BinaryDeserializer<'de> { type Error = Error; fn deserialize_any(self, visitor: V) -> Result @@ -1084,7 +1084,7 @@ impl<'de> serde::de::MapAccess<'de> for CodeWithScopeAccess<'de> { } } -impl<'a, 'de> serde::de::Deserializer<'de> for &'a CodeWithScopeAccess<'de> { +impl<'de> serde::de::Deserializer<'de> for &CodeWithScopeAccess<'de> { type Error = Error; fn deserialize_any(self, visitor: V) -> Result @@ -1180,7 +1180,7 @@ impl<'de> serde::de::MapAccess<'de> for DbPointerAccess<'de> { } } -impl<'a, 'de> serde::de::Deserializer<'de> for &'a mut DbPointerAccess<'de> { +impl<'de> serde::de::Deserializer<'de> for &mut DbPointerAccess<'de> { type Error = Error; fn deserialize_any(self, visitor: V) -> std::result::Result @@ -1289,7 +1289,7 @@ impl<'de> serde::de::MapAccess<'de> for RegexAccess<'de> { } } -impl<'a, 'de> serde::de::Deserializer<'de> for &'a mut RegexAccess<'de> { +impl<'de> serde::de::Deserializer<'de> for &mut RegexAccess<'de> { type Error = Error; fn deserialize_any(self, visitor: V) -> Result diff --git a/src/document.rs b/src/document.rs index b3e24067..ed8e8101 100644 --- a/src/document.rs +++ b/src/document.rs @@ -696,7 +696,7 @@ pub struct VacantEntry<'a> { inner: indexmap::map::VacantEntry<'a, String, Bson>, } -impl<'a> VacantEntry<'a> { +impl VacantEntry<'_> { /// Gets a reference to the key that would be used when inserting a value through the /// [VacantEntry]. fn key(&self) -> &str { @@ -709,7 +709,7 @@ pub struct OccupiedEntry<'a> { inner: indexmap::map::OccupiedEntry<'a, String, Bson>, } -impl<'a> OccupiedEntry<'a> { +impl OccupiedEntry<'_> { /// Gets a reference to the key in the entry. pub fn key(&self) -> &str { self.inner.key() diff --git a/src/raw/array.rs b/src/raw/array.rs index dd13164c..f6ed11ea 100644 --- a/src/raw/array.rs +++ b/src/raw/array.rs @@ -304,14 +304,14 @@ impl<'de: 'a, 'a> Deserialize<'de> for &'a RawArray { } } -impl<'a> Serialize for &'a RawArray { +impl Serialize for &RawArray { fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { struct SeqSerializer<'a>(&'a RawArray); - impl<'a> Serialize for SeqSerializer<'a> { + impl Serialize for SeqSerializer<'_> { fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, diff --git a/src/raw/array_buf.rs b/src/raw/array_buf.rs index 96797996..57dc6a5e 100644 --- a/src/raw/array_buf.rs +++ b/src/raw/array_buf.rs @@ -136,7 +136,7 @@ impl<'a> IntoIterator for &'a RawArrayBuf { } } -impl<'a> From for Cow<'a, RawArray> { +impl From for Cow<'_, RawArray> { fn from(rd: RawArrayBuf) -> Self { Cow::Owned(rd) } diff --git a/src/raw/bson_ref.rs b/src/raw/bson_ref.rs index 8241d879..f1f0fde9 100644 --- a/src/raw/bson_ref.rs +++ b/src/raw/bson_ref.rs @@ -312,7 +312,7 @@ impl<'de: 'a, 'a> Deserialize<'de> for RawBsonRef<'a> { } } -impl<'a> Serialize for RawBsonRef<'a> { +impl Serialize for RawBsonRef<'_> { fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, @@ -371,13 +371,13 @@ impl<'a> TryFrom> for Bson { } } -impl<'a> From for RawBsonRef<'a> { +impl From for RawBsonRef<'_> { fn from(i: i32) -> Self { RawBsonRef::Int32(i) } } -impl<'a> From for RawBsonRef<'a> { +impl From for RawBsonRef<'_> { fn from(i: i64) -> Self { RawBsonRef::Int64(i) } @@ -389,13 +389,13 @@ impl<'a> From<&'a str> for RawBsonRef<'a> { } } -impl<'a> From for RawBsonRef<'a> { +impl From for RawBsonRef<'_> { fn from(f: f64) -> Self { RawBsonRef::Double(f) } } -impl<'a> From for RawBsonRef<'a> { +impl From for RawBsonRef<'_> { fn from(b: bool) -> Self { RawBsonRef::Boolean(b) } @@ -425,25 +425,25 @@ impl<'a> From<&'a RawArrayBuf> for RawBsonRef<'a> { } } -impl<'a> From for RawBsonRef<'a> { +impl From for RawBsonRef<'_> { fn from(dt: crate::DateTime) -> Self { RawBsonRef::DateTime(dt) } } -impl<'a> From for RawBsonRef<'a> { +impl From for RawBsonRef<'_> { fn from(ts: Timestamp) -> Self { RawBsonRef::Timestamp(ts) } } -impl<'a> From for RawBsonRef<'a> { +impl From for RawBsonRef<'_> { fn from(oid: ObjectId) -> Self { RawBsonRef::ObjectId(oid) } } -impl<'a> From for RawBsonRef<'a> { +impl From for RawBsonRef<'_> { fn from(d: Decimal128) -> Self { RawBsonRef::Decimal128(d) } @@ -459,7 +459,7 @@ pub struct RawBinaryRef<'a> { pub bytes: &'a [u8], } -impl<'a> RawBinaryRef<'a> { +impl RawBinaryRef<'_> { /// Copy the contents into a [`Binary`]. pub fn to_binary(&self) -> Binary { Binary { @@ -491,7 +491,7 @@ impl<'de: 'a, 'a> Deserialize<'de> for RawBinaryRef<'a> { } } -impl<'a> Serialize for RawBinaryRef<'a> { +impl Serialize for RawBinaryRef<'_> { fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, @@ -569,7 +569,7 @@ impl<'de: 'a, 'a> Deserialize<'de> for RawRegexRef<'a> { } } -impl<'a> Serialize for RawRegexRef<'a> { +impl Serialize for RawRegexRef<'_> { fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, @@ -606,7 +606,7 @@ pub struct RawJavaScriptCodeWithScopeRef<'a> { pub scope: &'a RawDocument, } -impl<'a> RawJavaScriptCodeWithScopeRef<'a> { +impl RawJavaScriptCodeWithScopeRef<'_> { pub(crate) fn len(self) -> i32 { 4 + 4 + self.code.len() as i32 + 1 + self.scope.as_bytes().len() as i32 } @@ -627,7 +627,7 @@ impl<'de: 'a, 'a> Deserialize<'de> for RawJavaScriptCodeWithScopeRef<'a> { } } -impl<'a> Serialize for RawJavaScriptCodeWithScopeRef<'a> { +impl Serialize for RawJavaScriptCodeWithScopeRef<'_> { fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, @@ -667,7 +667,7 @@ impl<'de: 'a, 'a> Deserialize<'de> for RawDbPointerRef<'a> { } } -impl<'a> Serialize for RawDbPointerRef<'a> { +impl Serialize for RawDbPointerRef<'_> { fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, diff --git a/src/raw/document.rs b/src/raw/document.rs index 710cf699..8f725a0a 100644 --- a/src/raw/document.rs +++ b/src/raw/document.rs @@ -548,14 +548,14 @@ impl<'de: 'a, 'a> Deserialize<'de> for &'a RawDocument { } } -impl<'a> Serialize for &'a RawDocument { +impl Serialize for &RawDocument { fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { struct KvpSerializer<'a>(&'a RawDocument); - impl<'a> Serialize for KvpSerializer<'a> { + impl Serialize for KvpSerializer<'_> { fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, diff --git a/src/raw/document_buf.rs b/src/raw/document_buf.rs index 5a99fa72..6f7e73c3 100644 --- a/src/raw/document_buf.rs +++ b/src/raw/document_buf.rs @@ -268,7 +268,7 @@ impl std::fmt::Debug for RawDocumentBuf { } } -impl<'a> From for Cow<'a, RawDocument> { +impl From for Cow<'_, RawDocument> { fn from(rd: RawDocumentBuf) -> Self { Cow::Owned(rd) } diff --git a/src/raw/iter.rs b/src/raw/iter.rs index bff08502..9082dada 100644 --- a/src/raw/iter.rs +++ b/src/raw/iter.rs @@ -128,7 +128,7 @@ impl<'a> TryInto> for RawElement<'a> { } } -impl<'a> TryInto for RawElement<'a> { +impl TryInto for RawElement<'_> { type Error = Error; fn try_into(self) -> Result { @@ -136,7 +136,7 @@ impl<'a> TryInto for RawElement<'a> { } } -impl<'a> TryInto for RawElement<'a> { +impl TryInto for RawElement<'_> { type Error = Error; fn try_into(self) -> Result { @@ -340,7 +340,7 @@ impl<'a> RawElement<'a> { } } -impl<'a> RawIter<'a> { +impl RawIter<'_> { fn get_next_length_at(&self, start_at: usize) -> Result { let len = i32_from_slice(&self.doc.as_bytes()[start_at..])?; if len < 0 { diff --git a/src/raw/serde.rs b/src/raw/serde.rs index 1f877c1d..40dc03fb 100644 --- a/src/raw/serde.rs +++ b/src/raw/serde.rs @@ -54,7 +54,7 @@ impl<'a, 'de: 'a> Deserialize<'de> for OwnedOrBorrowedRawBson<'a> { } } -impl<'a> Debug for OwnedOrBorrowedRawBson<'a> { +impl Debug for OwnedOrBorrowedRawBson<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Owned(o) => o.fmt(f), @@ -69,7 +69,7 @@ impl<'a> From> for OwnedOrBorrowedRawBson<'a> { } } -impl<'a> From for OwnedOrBorrowedRawBson<'a> { +impl From for OwnedOrBorrowedRawBson<'_> { fn from(b: RawBson) -> Self { OwnedOrBorrowedRawBson::Owned(b) } @@ -82,7 +82,7 @@ pub(crate) enum OwnedOrBorrowedRawDocument<'a> { Borrowed(&'a RawDocument), } -impl<'a> OwnedOrBorrowedRawDocument<'a> { +impl OwnedOrBorrowedRawDocument<'_> { pub(crate) fn into_owned(self) -> RawDocumentBuf { match self { Self::Owned(o) => o, @@ -91,7 +91,7 @@ impl<'a> OwnedOrBorrowedRawDocument<'a> { } } -impl<'a> From for OwnedOrBorrowedRawDocument<'a> { +impl From for OwnedOrBorrowedRawDocument<'_> { fn from(doc: RawDocumentBuf) -> Self { Self::Owned(doc) } @@ -160,7 +160,7 @@ pub(crate) enum OwnedOrBorrowedRawArray<'a> { Borrowed(&'a RawArray), } -impl<'a> OwnedOrBorrowedRawArray<'a> { +impl OwnedOrBorrowedRawArray<'_> { pub(crate) fn into_owned(self) -> RawArrayBuf { match self { Self::Owned(o) => o, diff --git a/src/raw/serde/seeded_visitor.rs b/src/raw/serde/seeded_visitor.rs index 1d6f7ca9..16bbf466 100644 --- a/src/raw/serde/seeded_visitor.rs +++ b/src/raw/serde/seeded_visitor.rs @@ -82,7 +82,7 @@ pub(crate) struct SeededVisitor<'a, 'de> { buffer: &'a mut CowByteBuffer<'de>, } -impl<'a, 'de> DeserializeSeed<'de> for SeededVisitor<'a, 'de> { +impl<'de> DeserializeSeed<'de> for SeededVisitor<'_, 'de> { type Value = ElementType; fn deserialize(self, deserializer: D) -> Result @@ -93,7 +93,7 @@ impl<'a, 'de> DeserializeSeed<'de> for SeededVisitor<'a, 'de> { } } -impl<'a, 'de> DeserializeSeed<'de> for &mut SeededVisitor<'a, 'de> { +impl<'de> DeserializeSeed<'de> for &mut SeededVisitor<'_, 'de> { type Value = ElementType; fn deserialize(self, deserializer: D) -> Result @@ -233,7 +233,7 @@ impl<'a, 'de> SeededVisitor<'a, 'de> { } } -impl<'a, 'de> Visitor<'de> for SeededVisitor<'a, 'de> { +impl<'de> Visitor<'de> for SeededVisitor<'_, 'de> { type Value = ElementType; fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { diff --git a/src/ser/raw/document_serializer.rs b/src/ser/raw/document_serializer.rs index 9b20f5b8..114a11e9 100644 --- a/src/ser/raw/document_serializer.rs +++ b/src/ser/raw/document_serializer.rs @@ -66,7 +66,7 @@ impl<'a> DocumentSerializer<'a> { } } -impl<'a> serde::ser::SerializeSeq for DocumentSerializer<'a> { +impl serde::ser::SerializeSeq for DocumentSerializer<'_> { type Ok = (); type Error = Error; @@ -91,7 +91,7 @@ impl<'a> serde::ser::SerializeSeq for DocumentSerializer<'a> { } } -impl<'a> serde::ser::SerializeMap for DocumentSerializer<'a> { +impl serde::ser::SerializeMap for DocumentSerializer<'_> { type Ok = (); type Error = Error; @@ -117,7 +117,7 @@ impl<'a> serde::ser::SerializeMap for DocumentSerializer<'a> { } } -impl<'a> serde::ser::SerializeStruct for DocumentSerializer<'a> { +impl serde::ser::SerializeStruct for DocumentSerializer<'_> { type Ok = (); type Error = Error; @@ -137,7 +137,7 @@ impl<'a> serde::ser::SerializeStruct for DocumentSerializer<'a> { } } -impl<'a> serde::ser::SerializeTuple for DocumentSerializer<'a> { +impl serde::ser::SerializeTuple for DocumentSerializer<'_> { type Ok = (); type Error = Error; @@ -157,7 +157,7 @@ impl<'a> serde::ser::SerializeTuple for DocumentSerializer<'a> { } } -impl<'a> serde::ser::SerializeTupleStruct for DocumentSerializer<'a> { +impl serde::ser::SerializeTupleStruct for DocumentSerializer<'_> { type Ok = (); type Error = Error; @@ -183,13 +183,13 @@ struct KeySerializer<'a> { root_serializer: &'a mut Serializer, } -impl<'a> KeySerializer<'a> { +impl KeySerializer<'_> { fn invalid_key(v: T) -> Error { Error::InvalidDocumentKey(to_bson(&v).unwrap_or(Bson::Null)) } } -impl<'a> serde::Serializer for KeySerializer<'a> { +impl serde::Serializer for KeySerializer<'_> { type Ok = (); type Error = Error; diff --git a/src/ser/raw/mod.rs b/src/ser/raw/mod.rs index 1fb904f5..69b7320e 100644 --- a/src/ser/raw/mod.rs +++ b/src/ser/raw/mod.rs @@ -391,7 +391,7 @@ pub(crate) enum StructSerializer<'a> { Document(DocumentSerializer<'a>), } -impl<'a> SerializeStruct for StructSerializer<'a> { +impl SerializeStruct for StructSerializer<'_> { type Ok = (); type Error = Error; @@ -493,7 +493,7 @@ impl<'a> VariantSerializer<'a> { } } -impl<'a> serde::ser::SerializeTupleVariant for VariantSerializer<'a> { +impl serde::ser::SerializeTupleVariant for VariantSerializer<'_> { type Ok = (); type Error = Error; @@ -512,7 +512,7 @@ impl<'a> serde::ser::SerializeTupleVariant for VariantSerializer<'a> { } } -impl<'a> serde::ser::SerializeStructVariant for VariantSerializer<'a> { +impl serde::ser::SerializeStructVariant for VariantSerializer<'_> { type Ok = (); type Error = Error; diff --git a/src/ser/raw/value_serializer.rs b/src/ser/raw/value_serializer.rs index 46fb8623..8ed93eda 100644 --- a/src/ser/raw/value_serializer.rs +++ b/src/ser/raw/value_serializer.rs @@ -148,7 +148,7 @@ impl<'a> ValueSerializer<'a> { } } -impl<'a, 'b> serde::Serializer for &'b mut ValueSerializer<'a> { +impl<'b> serde::Serializer for &'b mut ValueSerializer<'_> { type Ok = (); type Error = Error; @@ -450,7 +450,7 @@ impl<'a, 'b> serde::Serializer for &'b mut ValueSerializer<'a> { } } -impl<'a, 'b> SerializeStruct for &'b mut ValueSerializer<'a> { +impl SerializeStruct for &mut ValueSerializer<'_> { type Ok = (); type Error = Error; @@ -597,7 +597,7 @@ impl<'a> CodeWithScopeSerializer<'a> { } } -impl<'a> SerializeMap for CodeWithScopeSerializer<'a> { +impl SerializeMap for CodeWithScopeSerializer<'_> { type Ok = (); type Error = Error; diff --git a/src/tests/serde_helpers.rs b/src/tests/serde_helpers.rs index 805aa93b..54df88cf 100644 --- a/src/tests/serde_helpers.rs +++ b/src/tests/serde_helpers.rs @@ -41,7 +41,7 @@ fn human_readable_wrapper() { D: serde::Deserializer<'de>, { struct V; - impl<'de> Visitor<'de> for V { + impl Visitor<'_> for V { type Value = bool; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/src/tests/spec/corpus.rs b/src/tests/spec/corpus.rs index 6df2487e..796d1a70 100644 --- a/src/tests/spec/corpus.rs +++ b/src/tests/spec/corpus.rs @@ -71,7 +71,7 @@ struct ParseError { struct FieldVisitor<'a, T>(&'a str, PhantomData); -impl<'de, 'a, T> serde::de::Visitor<'de> for FieldVisitor<'a, T> +impl<'de, T> serde::de::Visitor<'de> for FieldVisitor<'_, T> where T: Deserialize<'de>, {