camera: lint cleanup

This commit is contained in:
Bill Thiede 2021-07-18 12:14:13 -07:00
parent dbf5451070
commit 7e19d7e61b

View File

@ -243,15 +243,14 @@ impl Camera {
// Create a worker thread for each CPU core and pin the thread to the core. // Create a worker thread for each CPU core and pin the thread to the core.
let mut handles = core_ids let mut handles = core_ids
.into_iter() .into_iter()
.enumerate() .map(|id| {
.map(|(i, id)| {
let w = Arc::clone(&world); let w = Arc::clone(&world);
let c = Arc::clone(&camera); let c = Arc::clone(&camera);
let pixel_req_rx = pixel_req_rx.clone(); let pixel_req_rx = pixel_req_rx.clone();
let pixel_resp_tx = pixel_resp_tx.clone(); let pixel_resp_tx = pixel_resp_tx.clone();
thread::spawn(move || { thread::spawn(move || {
core_affinity::set_for_current(id); 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::<Vec<_>>(); .collect::<Vec<_>>();
@ -328,7 +327,6 @@ impl Camera {
} }
fn render_worker( fn render_worker(
tid: usize,
c: &Camera, c: &Camera,
w: &World, w: &World,
input_chan: Arc<Mutex<Receiver<Request>>>, input_chan: Arc<Mutex<Receiver<Request>>>,
@ -337,8 +335,11 @@ fn render_worker(
loop { loop {
let job = { input_chan.lock().unwrap().recv() }; let job = { input_chan.lock().unwrap().recv() };
match job { match job {
Err(err) => { Err(_) => {
eprintln!("Shutting down render_worker {}: {}", tid, 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; return;
} }
Ok(req) => match req { Ok(req) => match req {