From 7e19d7e61b6c68b0c288d79d6463ba910d8bb8c1 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sun, 18 Jul 2021 12:14:13 -0700 Subject: [PATCH] camera: lint cleanup --- rtchallenge/src/camera.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rtchallenge/src/camera.rs b/rtchallenge/src/camera.rs index 966e56c..1b2cc8f 100644 --- a/rtchallenge/src/camera.rs +++ b/rtchallenge/src/camera.rs @@ -243,15 +243,14 @@ impl Camera { // Create a worker thread for each CPU core and pin the thread to the core. let mut handles = core_ids .into_iter() - .enumerate() - .map(|(i, id)| { + .map(|id| { let w = Arc::clone(&world); let c = Arc::clone(&camera); let pixel_req_rx = pixel_req_rx.clone(); let pixel_resp_tx = pixel_resp_tx.clone(); thread::spawn(move || { core_affinity::set_for_current(id); - render_worker(i, &c, &w, pixel_req_rx, &pixel_resp_tx); + render_worker(&c, &w, pixel_req_rx, &pixel_resp_tx); }) }) .collect::>(); @@ -328,7 +327,6 @@ impl Camera { } fn render_worker( - tid: usize, c: &Camera, w: &World, input_chan: Arc>>, @@ -337,8 +335,11 @@ fn render_worker( loop { let job = { input_chan.lock().unwrap().recv() }; match job { - Err(err) => { - eprintln!("Shutting down render_worker {}: {}", tid, err); + Err(_) => { + // From the docs: + // "The recv operation can only fail if the sending half of a + // channel (or sync_channel) is disconnected, implying that no + // further messages will ever be received." return; } Ok(req) => match req {