Skip to content

Commit

Permalink
style: explicitly use Arc::clone
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanschellebeeck committed Oct 18, 2022
1 parent b3322e3 commit ccd73c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion exercises/threads/threads2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions exercises/threads/threads3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ impl Queue {

fn send_tx(q: Queue, tx: mpsc::Sender<u32>) -> () {
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 {
Expand Down

0 comments on commit ccd73c0

Please sign in to comment.