From aa92af8f3ce93ba99377529bec563be4c6b54942 Mon Sep 17 00:00:00 2001 From: Jeremy Andrews Date: Mon, 6 May 2024 14:23:09 +0100 Subject: [PATCH] fix clippy warnings --- src/controller.rs | 4 ++-- src/goose.rs | 6 +++--- src/lib.rs | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/controller.rs b/src/controller.rs index 64ef52c1..46edbe7e 100644 --- a/src/controller.rs +++ b/src/controller.rs @@ -777,7 +777,7 @@ impl GooseAttack { "changing startup_rate from {} to {}", self.configuration.startup_time, startup_time ); - self.configuration.startup_time = startup_time.clone(); + self.configuration.startup_time.clone_from(startup_time); // If setting startup_time, any existing configuration for a test plan isn't valid. self.configuration.test_plan = None; self.reply_to_controller( @@ -810,7 +810,7 @@ impl GooseAttack { "changing run_time from {:?} to {}", self.configuration.run_time, run_time ); - self.configuration.run_time = run_time.clone(); + self.configuration.run_time.clone_from(run_time); // If setting run_time, any existing configuration for a test plan isn't valid. self.configuration.test_plan = None; self.reply_to_controller( diff --git a/src/goose.rs b/src/goose.rs index ac234a5a..4ba0481d 100644 --- a/src/goose.rs +++ b/src/goose.rs @@ -3367,14 +3367,14 @@ mod tests { user.set_session_data(session_data); if let Some(session) = user.get_session_data_mut::() { - session.data = "bar".to_owned(); + "bar".clone_into(&mut session.data); } let session = user.get_session_data_unchecked::(); assert_eq!(session.data, "bar".to_string()); let session = user.get_session_data_unchecked_mut::(); - session.data = "foo".to_owned(); + "foo".clone_into(&mut session.data); let session = user.get_session_data_unchecked::(); assert_eq!(session.data, "foo".to_string()); } @@ -3396,7 +3396,7 @@ mod tests { user.set_session_data(session_data.clone()); - session_data.data = "bar".to_owned(); + "bar".clone_into(&mut session_data.data); user.set_session_data(session_data); let session = user.get_session_data_unchecked::(); diff --git a/src/lib.rs b/src/lib.rs index 437655da..ace680d8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1380,7 +1380,9 @@ impl GooseAttack { goose_attack_run_state.user_channels.push(parent_sender); // Clone the logger_tx if enabled, otherwise is None. - thread_user.logger = goose_attack_run_state.all_threads_logger_tx.clone(); + thread_user + .logger + .clone_from(&goose_attack_run_state.all_threads_logger_tx); // Copy the GooseUser-throttle receiver channel, used by all threads. thread_user.throttle = if self.configuration.throttle_requests > 0 {