From e1c430b9b296a3177d11c49f535a9739b8171261 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sat, 22 Sep 2018 12:25:22 -0700 Subject: [PATCH] Clippy lint. --- rtiow/src/kdtree.rs | 9 +++------ rtiow/src/renderer.rs | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/rtiow/src/kdtree.rs b/rtiow/src/kdtree.rs index e36c8f0..f6be57d 100644 --- a/rtiow/src/kdtree.rs +++ b/rtiow/src/kdtree.rs @@ -25,10 +25,7 @@ fn vec_first_into(v: Vec) -> T { v.len() )); } - for i in v.into_iter() { - return i; - } - panic!("Unreachable"); + v.into_iter().next().unwrap() } fn vec_split_into(v: Vec, offset: usize) -> (Vec, Vec) { @@ -167,9 +164,9 @@ impl Hit for KDTree { None => None, Some(_bbox) => match (left.hit(r, t_min, t_max), right.hit(r, t_min, t_max)) { (Some(hit_left), Some(hit_right)) => if hit_left.t < hit_right.t { - return Some(hit_left); + Some(hit_left) } else { - return Some(hit_right); + Some(hit_right) }, (Some(hit_left), None) => Some(hit_left), (None, Some(hit_right)) => Some(hit_right), diff --git a/rtiow/src/renderer.rs b/rtiow/src/renderer.rs index 586ccef..9eb51c4 100644 --- a/rtiow/src/renderer.rs +++ b/rtiow/src/renderer.rs @@ -128,7 +128,7 @@ fn render_worker( tid: usize, scene: &Scene, input_chan: channel::Receiver, - output_chan: channel::Sender<(usize, Vec)>, + output_chan: &channel::Sender<(usize, Vec)>, ) { for subsample in input_chan { let mut pixel_data: Vec = Vec::with_capacity(scene.width * scene.height); @@ -153,7 +153,7 @@ pub fn render(scene: Scene, output_dir: &Path) -> std::result::Result<(), std::i let seq_rx = seq_rx.clone(); let pixel_data_tx = pixel_data_tx.clone(); thread::spawn(move || { - render_worker(i, &s, seq_rx, pixel_data_tx); + render_worker(i, &s, seq_rx, &pixel_data_tx); }); } drop(seq_rx);