Skip to content

Commit e06744b

Browse files
minor: bump clippy to 1.78.0 (#1096)
1 parent 5824ee7 commit e06744b

File tree

13 files changed

+26
-24
lines changed

13 files changed

+26
-24
lines changed

.evergreen/check-clippy.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ set -o errexit
55
source ./.evergreen/env.sh
66

77
# Pin clippy to the latest version. This should be updated when new versions of Rust are released.
8-
CLIPPY_VERSION=1.75.0
8+
CLIPPY_VERSION=1.78.0
99

1010
rustup install $CLIPPY_VERSION
1111

1212
# Check with default features.
1313
cargo +$CLIPPY_VERSION clippy --all-targets -p mongodb -- -D warnings
1414

1515
# Check with all features.
16-
cargo +$CLIPPY_VERSION clippy --all-targets --all-features -p mongodb -- -D warnings
16+
cargo +$CLIPPY_VERSION clippy --all-targets --all-features -p mongodb -- -D warnings

src/client/auth/oidc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ impl Cache {
279279
self.idp_server_info = idp_server_info;
280280
}
281281
self.access_token = Some(response.access_token.clone());
282-
self.refresh_token = response.refresh_token.clone();
282+
self.refresh_token.clone_from(&response.refresh_token);
283283
self.last_call_time = Instant::now();
284284
self.token_gen_id += 1;
285285
}

src/client/options/parse.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl Action for ParseConnectionString {
2121
let mut options = ClientOptions::from_connection_string(conn_str);
2222
#[cfg(feature = "dns-resolver")]
2323
{
24-
options.resolver_config = self.resolver_config.clone();
24+
options.resolver_config.clone_from(&self.resolver_config);
2525
}
2626

2727
let resolved = host_info.resolve(self.resolver_config).await?;

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![warn(clippy::cast_possible_truncation)]
55
#![warn(clippy::cast_possible_wrap)]
66
#![cfg_attr(
7-
feature = "cargo-clippy",
7+
feature = "clippy",
88
allow(
99
clippy::unreadable_literal,
1010
clippy::cognitive_complexity,

src/sdam/description/topology.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl TopologyDescription {
175175
}
176176

177177
self.single_seed = self.servers.len() == 1;
178-
self.set_name = options.repl_set_name.clone();
178+
self.set_name.clone_from(&options.repl_set_name);
179179
self.local_threshold = options.local_threshold;
180180
self.heartbeat_freq = options.heartbeat_freq;
181181
self.srv_max_hosts = options.srv_max_hosts;

src/sdam/srv_polling/test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async fn run_test_extra(
4343
new_hosts: Result<Vec<ServerAddress>>,
4444
) -> HashSet<ServerAddress> {
4545
let mut options = ClientOptions::new_srv();
46-
options.hosts = DEFAULT_HOSTS.clone();
46+
options.hosts.clone_from(&DEFAULT_HOSTS);
4747
options.test_options_mut().disable_monitoring_threads = true;
4848
options.srv_max_hosts = max_hosts;
4949
let mut topology = Topology::new(options.clone()).unwrap();
@@ -132,7 +132,7 @@ async fn load_balanced_no_srv_polling() {
132132
let hosts = vec![localhost_test_build_10gen(27017)];
133133
let mut options = ClientOptions::new_srv();
134134
let rescan_interval = options.original_srv_info.as_ref().cloned().unwrap().min_ttl;
135-
options.hosts = hosts.clone();
135+
options.hosts.clone_from(&hosts);
136136
options.load_balanced = Some(true);
137137
options.test_options_mut().mock_lookup_hosts = Some(make_lookup_hosts(vec![
138138
localhost_test_build_10gen(27017),

src/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ pub(crate) static DEFAULT_GLOBAL_TRACING_HANDLER: Lazy<TracingHandler> = Lazy::n
114114

115115
pub(crate) fn update_options_for_testing(options: &mut ClientOptions) {
116116
if options.server_api.is_none() {
117-
options.server_api = SERVER_API.clone();
117+
options.server_api.clone_from(&SERVER_API);
118118
}
119119

120120
#[cfg(any(

src/test/spec/initial_dns_seedlist_discovery.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ async fn run_test(mut test_file: TestFile) {
135135
} else {
136136
let mut options_with_tls = options.clone();
137137
if requires_tls {
138-
options_with_tls.tls = get_client_options().await.tls.clone();
138+
options_with_tls
139+
.tls
140+
.clone_from(&get_client_options().await.tls);
139141
}
140142

141143
let client = Client::with_options(options_with_tls).unwrap();

src/test/spec/retryable_reads.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@ async fn retry_read_pool_cleared() {
138138
.expect("pool clear should occur");
139139

140140
let next_cmap_events = subscriber
141-
.collect_events(Duration::from_millis(1000), |event| match event {
142-
Event::Cmap(_) => true,
143-
_ => false,
141+
.collect_events(Duration::from_millis(1000), |event| {
142+
matches!(event, Event::Cmap(_))
144143
})
145144
.await;
146145

src/test/spec/retryable_writes.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async fn run_legacy() {
4949
continue;
5050
}
5151
let mut options = test_case.client_options.unwrap_or_default();
52-
options.hosts = get_client_options().await.hosts.clone();
52+
options.hosts.clone_from(&get_client_options().await.hosts);
5353
if options.heartbeat_freq.is_none() {
5454
options.heartbeat_freq = Some(MIN_HEARTBEAT_FREQUENCY);
5555
}
@@ -455,9 +455,8 @@ async fn retry_write_pool_cleared() {
455455
.expect("pool clear should occur");
456456

457457
let next_cmap_events = subscriber
458-
.collect_events(Duration::from_millis(1000), |event| match event {
459-
Event::Cmap(_) => true,
460-
_ => false,
458+
.collect_events(Duration::from_millis(1000), |event| {
459+
matches!(event, Event::Cmap(_))
461460
})
462461
.await;
463462

src/test/spec/trace.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,27 @@ fn tracing_truncation() {
4949
assert_eq!(s, String::from("..."));
5050

5151
// we should "round up" to the end of the first emoji
52-
s = two_emoji.clone();
52+
s.clone_from(&two_emoji);
5353
truncate_on_char_boundary(&mut s, 1);
5454
assert_eq!(s, String::from("🤔..."));
5555

5656
// 4 is a boundary, so we should truncate there
57-
s = two_emoji.clone();
57+
s.clone_from(&two_emoji);
5858
truncate_on_char_boundary(&mut s, 4);
5959
assert_eq!(s, String::from("🤔..."));
6060

6161
// we should round up to the full string
62-
s = two_emoji.clone();
62+
s.clone_from(&two_emoji);
6363
truncate_on_char_boundary(&mut s, 5);
6464
assert_eq!(s, two_emoji);
6565

6666
// end of string is a boundary, so we should truncate there
67-
s = two_emoji.clone();
67+
s.clone_from(&two_emoji);
6868
truncate_on_char_boundary(&mut s, 8);
6969
assert_eq!(s, two_emoji);
7070

7171
// we should get the full string back if the new length is longer than the original
72-
s = two_emoji.clone();
72+
s.clone_from(&two_emoji);
7373
truncate_on_char_boundary(&mut s, 10);
7474
assert_eq!(s, two_emoji);
7575
}

src/test/spec/unified_runner/operation.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ pub(crate) trait TestOperation: Debug + Send + Sync {
124124

125125
/// If this operation specifies entities to create, returns those entities. Otherwise,
126126
/// returns None.
127+
#[cfg(feature = "tracing-unstable")]
127128
fn test_file_entities(&self) -> Option<&Vec<TestFileEntity>> {
128129
None
129130
}
@@ -2307,7 +2308,7 @@ impl TestOperation for RenameCollection {
23072308
let target = test_runner.get_collection(id).await;
23082309
let ns = target.namespace();
23092310
let mut to_ns = ns.clone();
2310-
to_ns.coll = self.to.clone();
2311+
to_ns.coll.clone_from(&self.to);
23112312
let cmd = doc! {
23122313
"renameCollection": crate::bson::to_bson(&ns)?,
23132314
"to": crate::bson::to_bson(&to_ns)?,
@@ -2741,6 +2742,7 @@ impl TestOperation for CreateEntities {
27412742
.boxed()
27422743
}
27432744

2745+
#[cfg(feature = "tracing-unstable")]
27442746
fn test_file_entities(&self) -> Option<&Vec<TestFileEntity>> {
27452747
Some(&self.entities)
27462748
}

src/test/spec/unified_runner/test_file.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ impl ExpectError {
500500
let description = description.as_ref();
501501

502502
if let Some(is_client_error) = self.is_client_error {
503-
if is_client_error != !error.is_server_error() {
503+
if is_client_error == error.is_server_error() {
504504
return Err(format!(
505505
"{}: expected client error but got {:?}",
506506
description, error

0 commit comments

Comments
 (0)