Skip to content

minor: bump clippy to 1.71 #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .evergreen/check-clippy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.65.0
CLIPPY_VERSION=1.71.0

rustup install $CLIPPY_VERSION

Expand Down
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
msrv = "1.60.0"
10 changes: 5 additions & 5 deletions src/de/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ impl TimestampDeserializer {
impl<'de, 'a> serde::de::Deserializer<'de> for &'a mut TimestampDeserializer {
type Error = Error;

fn deserialize_any<V>(mut self, visitor: V) -> Result<V::Value>
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value>
where
V: serde::de::Visitor<'de>,
{
Expand Down Expand Up @@ -1095,7 +1095,7 @@ impl DateTimeDeserializer {
impl<'de, 'a> serde::de::Deserializer<'de> for &'a mut DateTimeDeserializer {
type Error = Error;

fn deserialize_any<V>(mut self, visitor: V) -> Result<V::Value>
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value>
where
V: serde::de::Visitor<'de>,
{
Expand Down Expand Up @@ -1196,7 +1196,7 @@ impl<'a> BinaryDeserializer<'a> {
impl<'de, 'a> serde::de::Deserializer<'de> for &'a mut BinaryDeserializer<'de> {
type Error = Error;

fn deserialize_any<V>(mut self, visitor: V) -> Result<V::Value>
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value>
where
V: serde::de::Visitor<'de>,
{
Expand Down Expand Up @@ -1330,7 +1330,7 @@ impl<'de, 'a> CodeWithScopeDeserializer<'de, 'a> {
impl<'de, 'a, 'b> serde::de::Deserializer<'de> for &'b mut CodeWithScopeDeserializer<'de, 'a> {
type Error = Error;

fn deserialize_any<V>(mut self, visitor: V) -> Result<V::Value>
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value>
where
V: serde::de::Visitor<'de>,
{
Expand Down Expand Up @@ -1447,7 +1447,7 @@ impl<'de, 'a> DbPointerDeserializer<'de, 'a> {
impl<'de, 'a, 'b> serde::de::Deserializer<'de> for &'b mut DbPointerDeserializer<'de, 'a> {
type Error = Error;

fn deserialize_any<V>(mut self, visitor: V) -> Result<V::Value>
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value>
where
V: serde::de::Visitor<'de>,
{
Expand Down
10 changes: 5 additions & 5 deletions src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl Document {
/// Get a reference to a Decimal128 value for key, if it exists.
pub fn get_decimal128(&self, key: impl AsRef<str>) -> ValueAccessResult<&Decimal128> {
match self.get(key) {
Some(&Bson::Decimal128(ref v)) => Ok(v),
Some(Bson::Decimal128(v)) => Ok(v),
Some(_) => Err(ValueAccessError::UnexpectedType),
None => Err(ValueAccessError::NotPresent),
}
Expand All @@ -274,7 +274,7 @@ impl Document {
/// Get a string slice this key if it exists and has the correct type.
pub fn get_str(&self, key: impl AsRef<str>) -> ValueAccessResult<&str> {
match self.get(key) {
Some(&Bson::String(ref v)) => Ok(v),
Some(Bson::String(v)) => Ok(v),
Some(_) => Err(ValueAccessError::UnexpectedType),
None => Err(ValueAccessError::NotPresent),
}
Expand All @@ -293,7 +293,7 @@ impl Document {
/// the correct type.
pub fn get_array(&self, key: impl AsRef<str>) -> ValueAccessResult<&Array> {
match self.get(key) {
Some(&Bson::Array(ref v)) => Ok(v),
Some(Bson::Array(v)) => Ok(v),
Some(_) => Err(ValueAccessError::UnexpectedType),
None => Err(ValueAccessError::NotPresent),
}
Expand All @@ -313,7 +313,7 @@ impl Document {
/// the correct type.
pub fn get_document(&self, key: impl AsRef<str>) -> ValueAccessResult<&Document> {
match self.get(key) {
Some(&Bson::Document(ref v)) => Ok(v),
Some(Bson::Document(v)) => Ok(v),
Some(_) => Err(ValueAccessError::UnexpectedType),
None => Err(ValueAccessError::NotPresent),
}
Expand Down Expand Up @@ -458,7 +458,7 @@ impl Document {
/// Get a reference to a UTC datetime value for this key if it exists and has the correct type.
pub fn get_datetime(&self, key: impl AsRef<str>) -> ValueAccessResult<&crate::DateTime> {
match self.get(key) {
Some(&Bson::DateTime(ref v)) => Ok(v),
Some(Bson::DateTime(v)) => Ok(v),
Some(_) => Err(ValueAccessError::UnexpectedType),
None => Err(ValueAccessError::NotPresent),
}
Expand Down
6 changes: 1 addition & 5 deletions src/ser/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,7 @@ impl<'a> serde::Serializer for &'a mut Serializer {
}

#[inline]
fn serialize_newtype_struct<T: ?Sized>(
mut self,
name: &'static str,
value: &T,
) -> Result<Self::Ok>
fn serialize_newtype_struct<T: ?Sized>(self, name: &'static str, value: &T) -> Result<Self::Ok>
where
T: serde::Serialize,
{
Expand Down
20 changes: 10 additions & 10 deletions src/tests/modules/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,19 @@ fn recursive_macro() {
};

match doc.get("a") {
Some(&Bson::String(ref s)) => assert_eq!("foo", s),
Some(Bson::String(s)) => assert_eq!("foo", s),
_ => panic!("String 'foo' was not inserted correctly."),
}

// Inner Doc 1
match doc.get("b") {
Some(&Bson::Document(ref doc)) => {
Some(Bson::Document(doc)) => {
// Inner doc 2
match doc.get("bar") {
Some(&Bson::Document(ref inner_doc)) => {
Some(Bson::Document(inner_doc)) => {
// Inner array
match inner_doc.get("harbor") {
Some(&Bson::Array(ref arr)) => {
Some(Bson::Array(arr)) => {
assert_eq!(2, arr.len());

// Match array items
Expand All @@ -177,7 +177,7 @@ fn recursive_macro() {

// Inner floating point
match inner_doc.get("jelly") {
Some(&Bson::Double(ref fp)) => assert_eq!(42.0, *fp),
Some(Bson::Double(fp)) => assert_eq!(42.0, *fp),
_ => panic!("Floating point 42.0 was not inserted correctly."),
}
}
Expand All @@ -189,7 +189,7 @@ fn recursive_macro() {

// Single-item array
match doc.get("c") {
Some(&Bson::Array(ref arr)) => {
Some(Bson::Array(arr)) => {
assert_eq!(1, arr.len());

// Integer type
Expand All @@ -203,15 +203,15 @@ fn recursive_macro() {

// Document nested in array
match doc.get("d") {
Some(&Bson::Array(ref arr)) => {
Some(Bson::Array(arr)) => {
assert_eq!(1, arr.len());

// Nested document
match arr.get(0) {
Some(Bson::Document(ref doc)) => {
// String
match doc.get("apple") {
Some(&Bson::String(ref s)) => assert_eq!("ripe", s),
Some(Bson::String(s)) => assert_eq!("ripe", s),
_ => panic!("String 'ripe' was not inserted correctly."),
}
}
Expand All @@ -223,10 +223,10 @@ fn recursive_macro() {

// Single-item document
match doc.get("e") {
Some(&Bson::Document(ref bdoc)) => {
Some(Bson::Document(bdoc)) => {
// String
match bdoc.get("single") {
Some(&Bson::String(ref s)) => assert_eq!("test", s),
Some(Bson::String(s)) => assert_eq!("test", s),
_ => panic!("String 'test' was not inserted correctly."),
}
}
Expand Down