Finish up clippy lint.

This commit is contained in:
2019-02-26 19:00:58 -08:00
parent e64e6af085
commit 0ec6f46be0
7 changed files with 29 additions and 23 deletions

View File

@@ -42,7 +42,7 @@ impl fmt::Display for BVHNode {
}
// Lint is wrong when dealing with Box<Trait>
#[cfg_attr(feature = "cargo-clippy", allow(borrowed_box))]
#[allow(clippy::borrowed_box)]
fn box_x_compare(ah: &Box<Hit>, bh: &Box<Hit>) -> std::cmp::Ordering {
match (ah.bounding_box(0., 0.), bh.bounding_box(0., 0.)) {
(Some(box_left), Some(box_right)) => {
@@ -52,7 +52,7 @@ fn box_x_compare(ah: &Box<Hit>, bh: &Box<Hit>) -> std::cmp::Ordering {
}
}
#[cfg_attr(feature = "cargo-clippy", allow(borrowed_box))]
#[allow(clippy::borrowed_box)]
fn box_y_compare(ah: &Box<Hit>, bh: &Box<Hit>) -> std::cmp::Ordering {
match (ah.bounding_box(0., 0.), bh.bounding_box(0., 0.)) {
(Some(box_left), Some(box_right)) => {
@@ -62,7 +62,7 @@ fn box_y_compare(ah: &Box<Hit>, bh: &Box<Hit>) -> std::cmp::Ordering {
}
}
#[cfg_attr(feature = "cargo-clippy", allow(borrowed_box))]
#[allow(clippy::borrowed_box)]
fn box_z_compare(ah: &Box<Hit>, bh: &Box<Hit>) -> std::cmp::Ordering {
match (ah.bounding_box(0., 0.), bh.bounding_box(0., 0.)) {
(Some(box_left), Some(box_right)) => {
@@ -153,11 +153,13 @@ impl Hit for BVHNode {
Some(ref bbox) => {
if bbox.hit(r, t_min, t_max) {
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 {
Some(hit_left)
} else {
Some(hit_right)
},
(Some(hit_left), Some(hit_right)) => {
if hit_left.t < hit_right.t {
Some(hit_left)
} else {
Some(hit_right)
}
}
(Some(hit_left), None) => Some(hit_left),
(None, Some(hit_right)) => Some(hit_right),
(None, None) => None,