Made some minor improvements suggested by clippy

This commit is contained in:
Matthew Gordon 2020-08-15 00:06:06 -04:00
parent 8be0c0a21b
commit 5c2fbf995a
2 changed files with 3 additions and 3 deletions

View File

@ -64,7 +64,7 @@ fn parse_args() -> CommandLineParameters {
let mut size_iter = matches.values_of("size").unwrap(); let mut size_iter = matches.values_of("size").unwrap();
let width = size_iter.next().unwrap().parse().unwrap(); let width = size_iter.next().unwrap().parse().unwrap();
let height = size_iter.next().unwrap().parse().unwrap(); let height = size_iter.next().unwrap().parse().unwrap();
let output_file = matches.value_of_os("output_png").map(|f| PathBuf::from(f)); let output_file = matches.value_of_os("output_png").map(PathBuf::from);
let time = matches.value_of("time").unwrap().parse().unwrap(); let time = matches.value_of("time").unwrap().parse().unwrap();
CommandLineParameters { CommandLineParameters {
width, width,

View File

@ -61,7 +61,7 @@ impl<T: Real> BoundingVolumeHierarchy<T> {
.iter() .iter()
.fold(BoundingBox::empty(), |acc, p| acc.union(&p.bounding_box())); .fold(BoundingBox::empty(), |acc, p| acc.union(&p.bounding_box()));
if primitives.len() <= 1 { if primitives.len() <= 1 {
let primitives = primitives.iter().cloned().collect(); let primitives = primitives.to_vec();
BoundingVolumeHierarchy::Leaf { bounds, primitives } BoundingVolumeHierarchy::Leaf { bounds, primitives }
} else { } else {
let pivot = heuristic_split(primitives, &bounds); let pivot = heuristic_split(primitives, &bounds);
@ -116,7 +116,7 @@ impl<T: Real> Intersect<T> for BoundingVolumeHierarchy<T> {
primitives primitives
.iter() .iter()
.map(|elem| elem.intersect(&ray)) .map(|elem| elem.intersect(&ray))
.fold(None, |acc, elem| closest_intersection(acc, elem)) .fold(None, closest_intersection)
} else { } else {
None None
} }