From ccd73c0a815bbf5bdb1d215e0e0417f5ea216e68 Mon Sep 17 00:00:00 2001 From: Matthew Van Schellebeeck Date: Sun, 16 Oct 2022 08:18:56 -0400 Subject: [PATCH] style: explicitly use Arc::clone --- exercises/threads/threads2.rs | 2 +- exercises/threads/threads3.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/threads/threads2.rs b/exercises/threads/threads2.rs index d0f8578..ada3d14 100644 --- a/exercises/threads/threads2.rs +++ b/exercises/threads/threads2.rs @@ -17,7 +17,7 @@ fn main() { let status = Arc::new(JobStatus { jobs_completed: 0 }); let mut handles = vec![]; for _ in 0..10 { - let status_shared = status.clone(); + let status_shared = Arc::clone(&status); let handle = thread::spawn(move || { thread::sleep(Duration::from_millis(250)); // TODO: You must take an action before you update a shared value diff --git a/exercises/threads/threads3.rs b/exercises/threads/threads3.rs index 27e9908..9e9f285 100644 --- a/exercises/threads/threads3.rs +++ b/exercises/threads/threads3.rs @@ -26,8 +26,8 @@ impl Queue { fn send_tx(q: Queue, tx: mpsc::Sender) -> () { let qc = Arc::new(q); - let qc1 = qc.clone(); - let qc2 = qc.clone(); + let qc1 = Arc::clone(&qc); + let qc2 = Arc::clone(&qc); thread::spawn(move || { for val in &qc1.first_half {