Skip to content

Commit 5e5f7ad

Browse files
committed
minor: fix clippy
1 parent f5b0c92 commit 5e5f7ad

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed

src/client/auth/plain.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ pub(crate) async fn authenticate_stream(
4646
}
4747

4848
fn payload_bytes(username: &str, password: &str) -> Vec<u8> {
49-
let mut bytes = Vec::new();
50-
51-
bytes.push(0);
49+
let mut bytes = vec![0];
5250
bytes.extend(username.as_bytes());
5351

5452
bytes.push(0);

src/sdam/description/server.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const DRIVER_MAX_WIRE_VERSION: i32 = 7;
1717

1818
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
1919
#[non_exhaustive]
20+
#[allow(clippy::upper_case_acronyms)]
2021
pub enum ServerType {
2122
Standalone,
2223
Mongos,

src/sdam/description/topology/server_selection/test/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ struct LastWriteDate {
117117
}
118118

119119
#[derive(Clone, Copy, Debug, Deserialize)]
120+
#[allow(clippy::upper_case_acronyms)]
120121
enum TestServerType {
121122
Standalone,
122123
Mongos,

src/test/spec/auth.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ struct TestCredential {
2222
pub mechanism_properties: Option<Document>,
2323
}
2424

25-
impl Into<Credential> for TestCredential {
26-
fn into(self) -> Credential {
25+
impl From<TestCredential> for Credential {
26+
fn from(test_credential: TestCredential) -> Credential {
2727
Credential {
28-
username: self.username,
29-
password: self.password,
30-
source: self.source,
31-
mechanism: self
28+
username: test_credential.username,
29+
password: test_credential.password,
30+
source: test_credential.source,
31+
mechanism: test_credential
3232
.mechanism
3333
.and_then(|s| AuthMechanism::from_str(s.as_str()).ok()),
34-
mechanism_properties: self.mechanism_properties,
34+
mechanism_properties: test_credential.mechanism_properties,
3535
}
3636
}
3737
}

src/test/spec/initial_dns_seedlist_discovery.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async fn run() {
6060
};
6161

6262
if let Some(true) = test_file.error {
63-
assert!(matches!(result, Err(_)), test_file.comment.unwrap());
63+
assert!(matches!(result, Err(_)), "{}", test_file.comment.unwrap());
6464
return;
6565
}
6666

src/test/spec/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ where
7676
run_test_file(
7777
bson::from_bson(
7878
Bson::try_from(json)
79-
.unwrap_or_else(|_| panic!(test_file_full_path.display().to_string())),
79+
.unwrap_or_else(|_| panic!("{}", test_file_full_path.display().to_string())),
8080
)
8181
.unwrap_or_else(|e| panic!("{}: {}", test_file_full_path.display().to_string(), e)),
8282
)

src/test/spec/unified_runner/matcher.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,14 @@ async fn array_matching() {
273273
None,
274274
));
275275

276-
let mut actual: Vec<Bson> = Vec::new();
277-
actual.push(Bson::Document(doc! { "x": 1, "y": 1 }));
278-
actual.push(Bson::Document(doc! { "x": 2, "y": 2 }));
279-
let mut expected: Vec<Bson> = Vec::new();
280-
expected.push(Bson::Document(doc! { "x": 1 }));
281-
expected.push(Bson::Document(doc! { "x": 2 }));
276+
let actual: Vec<Bson> = vec![
277+
Bson::Document(doc! { "x": 1, "y": 1 }),
278+
Bson::Document(doc! { "x": 2, "y": 2 }),
279+
];
280+
let expected: Vec<Bson> = vec![
281+
Bson::Document(doc! { "x": 1 }),
282+
Bson::Document(doc! { "x": 2 }),
283+
];
282284
assert!(!results_match(
283285
Some(&Bson::Array(actual)),
284286
&Bson::Array(expected),

0 commit comments

Comments
 (0)