Clippy lint.

This commit is contained in:
Bill Thiede 2018-09-22 12:25:22 -07:00
parent fecd7b6a00
commit e1c430b9b2
2 changed files with 5 additions and 8 deletions

View File

@ -25,10 +25,7 @@ fn vec_first_into<T>(v: Vec<T>) -> T {
v.len()
));
}
for i in v.into_iter() {
return i;
}
panic!("Unreachable");
v.into_iter().next().unwrap()
}
fn vec_split_into<T>(v: Vec<T>, offset: usize) -> (Vec<T>, Vec<T>) {
@ -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),

View File

@ -128,7 +128,7 @@ fn render_worker(
tid: usize,
scene: &Scene,
input_chan: channel::Receiver<usize>,
output_chan: channel::Sender<(usize, Vec<Vec3>)>,
output_chan: &channel::Sender<(usize, Vec<Vec3>)>,
) {
for subsample in input_chan {
let mut pixel_data: Vec<Vec3> = 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);