Skip to content

Commit fa22f4e

Browse files
minor: fix clippy (#267)
1 parent a2d40b8 commit fa22f4e

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

src/bson.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl Display for Bson {
118118
}) => write!(fmt, "/{}/{}", pattern, options),
119119
Bson::JavaScriptCode(ref code)
120120
| Bson::JavaScriptCodeWithScope(JavaScriptCodeWithScope { ref code, .. }) => {
121-
fmt.write_str(&code)
121+
fmt.write_str(code)
122122
}
123123
Bson::Int32(i) => write!(fmt, "{}", i),
124124
Bson::Int64(i) => write!(fmt, "{}", i),

src/de/serde.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ impl<'de> de::Deserializer<'de> for Deserializer {
326326
Bson::Binary(Binary {
327327
subtype: BinarySubtype::Generic,
328328
ref bytes,
329-
}) => visitor.visit_bytes(&bytes),
329+
}) => visitor.visit_bytes(bytes),
330330
binary @ Bson::Binary(..) => visitor.visit_map(MapDeserializer {
331331
iter: binary.to_extended_document().into_iter(),
332332
value: None,

src/extjson/de.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl TryFrom<serde_json::Value> for Bson {
200200
.or_else(|| x.as_f64().map(Bson::from))
201201
.ok_or_else(|| {
202202
Error::invalid_value(
203-
Unexpected::Other(&format!("{}", x).as_str()),
203+
Unexpected::Other(format!("{}", x).as_str()),
204204
&"a number that could fit in i32, i64, or f64",
205205
)
206206
}),

src/ser/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ pub(crate) fn serialize_bson<W: Write + ?Sized>(
108108

109109
match *val {
110110
Bson::Double(v) => write_f64(writer, v),
111-
Bson::String(ref v) => write_string(writer, &v),
112-
Bson::Array(ref v) => serialize_array(writer, &v),
111+
Bson::String(ref v) => write_string(writer, v),
112+
Bson::Array(ref v) => serialize_array(writer, v),
113113
Bson::Document(ref v) => v.to_writer(writer),
114114
Bson::Boolean(v) => writer
115115
.write_all(&[if v { 0x01 } else { 0x00 }])
@@ -121,7 +121,7 @@ pub(crate) fn serialize_bson<W: Write + ?Sized>(
121121
write_cstring(writer, pattern)?;
122122
write_cstring(writer, options)
123123
}
124-
Bson::JavaScriptCode(ref code) => write_string(writer, &code),
124+
Bson::JavaScriptCode(ref code) => write_string(writer, code),
125125
Bson::ObjectId(ref id) => writer.write_all(&id.bytes()).map_err(From::from),
126126
Bson::JavaScriptCodeWithScope(JavaScriptCodeWithScope {
127127
ref code,
@@ -155,7 +155,7 @@ pub(crate) fn serialize_bson<W: Write + ?Sized>(
155155
}
156156
Bson::DateTime(ref v) => write_i64(writer, v.timestamp_millis()),
157157
Bson::Null => Ok(()),
158-
Bson::Symbol(ref v) => write_string(writer, &v),
158+
Bson::Symbol(ref v) => write_string(writer, v),
159159
#[cfg(not(feature = "decimal128"))]
160160
Bson::Decimal128(ref v) => {
161161
writer.write_all(&v.bytes)?;

src/tests/modules/document.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ fn test_getters() {
105105

106106
doc.insert("null".to_string(), Bson::Null);
107107
assert_eq!(Some(&Bson::Null), doc.get("null"));
108-
assert_eq!(true, doc.is_null("null"));
109-
assert_eq!(false, doc.is_null("array"));
108+
assert!(doc.is_null("null"));
109+
assert!(!doc.is_null("array"));
110110

111111
assert_eq!(Some(&Bson::Int32(1)), doc.get("i32"));
112112
assert_eq!(Ok(1i32), doc.get_i32("i32"));

src/tests/modules/ser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn boolean() {
5050
let _guard = LOCK.run_concurrently();
5151
let obj = Bson::Boolean(true);
5252
let b: bool = from_bson(obj.clone()).unwrap();
53-
assert_eq!(b, true);
53+
assert!(b);
5454

5555
let deser: Bson = to_bson(&b).unwrap();
5656
assert_eq!(deser, obj);

src/tests/serde.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ fn test_datetime_helpers() {
760760
}
761761
}
762762
}"#;
763-
let json: serde_json::Value = serde_json::from_str(&date).unwrap();
763+
let json: serde_json::Value = serde_json::from_str(date).unwrap();
764764
let b: B = serde_json::from_value(json).unwrap();
765765
let expected: chrono::DateTime<chrono::Utc> =
766766
chrono::DateTime::from_str("2020-06-09 10:58:07.095 UTC").unwrap();

0 commit comments

Comments
 (0)