diff --git a/rtiow/src/bvh.rs b/rtiow/src/bvh.rs index e792857..fcf8898 100644 --- a/rtiow/src/bvh.rs +++ b/rtiow/src/bvh.rs @@ -42,7 +42,7 @@ impl fmt::Display for BVHNode { } // Lint is wrong when dealing with Box -#[cfg_attr(feature = "cargo-clippy", allow(borrowed_box))] +#[allow(clippy::borrowed_box)] fn box_x_compare(ah: &Box, bh: &Box) -> 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, bh: &Box) -> std::cmp::Ordering { } } -#[cfg_attr(feature = "cargo-clippy", allow(borrowed_box))] +#[allow(clippy::borrowed_box)] fn box_y_compare(ah: &Box, bh: &Box) -> 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, bh: &Box) -> std::cmp::Ordering { } } -#[cfg_attr(feature = "cargo-clippy", allow(borrowed_box))] +#[allow(clippy::borrowed_box)] fn box_z_compare(ah: &Box, bh: &Box) -> 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, diff --git a/rtiow/src/camera.rs b/rtiow/src/camera.rs index 38c6289..58bb7c4 100644 --- a/rtiow/src/camera.rs +++ b/rtiow/src/camera.rs @@ -11,11 +11,12 @@ fn random_in_unit_disk() -> Vec3 { let mut rng = rand::thread_rng(); let v = Vec3::new(1., 1., 0.); loop { - let p = 2. * Vec3::new( - rng.gen_range::(0., 1.), - rng.gen_range::(0., 1.), - 0., - ) - v; + let p = + 2. * Vec3::new( + rng.gen_range::(0., 1.), + rng.gen_range::(0., 1.), + 0., + ) - v; if p.squared_length() < 1. { return p; } @@ -36,7 +37,7 @@ pub struct Camera { impl Camera { // Parameters match the example C++ code. - #[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))] + #[allow(clippy::too_many_arguments)] // vfov is top to bottom in degrees pub fn new( lookfrom: Vec3, diff --git a/rtiow/src/cuboid.rs b/rtiow/src/cuboid.rs index 8b4080f..ee66100 100644 --- a/rtiow/src/cuboid.rs +++ b/rtiow/src/cuboid.rs @@ -20,7 +20,7 @@ pub struct Cuboid { impl Cuboid { // This clippy doesn't work right with Arc. - #[cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))] + #[allow(clippy::needless_pass_by_value)] pub fn new(p_min: Vec3, p_max: Vec3, material: Arc) -> Cuboid { Cuboid { p_min, diff --git a/rtiow/src/noise/lode.rs b/rtiow/src/noise/lode.rs index 9e26273..0df62f2 100644 --- a/rtiow/src/noise/lode.rs +++ b/rtiow/src/noise/lode.rs @@ -17,7 +17,7 @@ impl Lode { { let mut noise = vec![vec![vec![0.; NOISE_SIZE]; NOISE_SIZE]; NOISE_SIZE]; // Squelch warning about only being used to index, as this way reads more consistently. - #[cfg_attr(feature = "cargo-clippy", allow(needless_range_loop))] + #[allow(clippy::needless_range_loop)] for x in 0..NOISE_SIZE { for y in 0..NOISE_SIZE { for z in 0..NOISE_SIZE { diff --git a/rtiow/src/noise/perlin.rs b/rtiow/src/noise/perlin.rs index 8cc7f32..911ea58 100644 --- a/rtiow/src/noise/perlin.rs +++ b/rtiow/src/noise/perlin.rs @@ -1,5 +1,5 @@ // There are many math functions in this file, so we allow single letter variable names. -#![cfg_attr(feature = "cargo-clippy", allow(many_single_char_names))] +#![allow(clippy::many_single_char_names)] use rand::Rng; use crate::noise::NoiseSource; @@ -23,8 +23,10 @@ where rng.gen_range::(-1., 1.), rng.gen_range::(-1., 1.), rng.gen_range::(-1., 1.), - ).unit_vector() - }).collect() + ) + .unit_vector() + }) + .collect() } fn perlin_generate_perm(rng: &mut R) -> Vec @@ -134,13 +136,13 @@ impl NoiseSource for Perlin { let mut c: [[[Vec3; 2]; 2]; 2] = Default::default(); // Squelch warning about di only being used to index, as this way reads more consistently. - #[cfg_attr(feature = "cargo-clippy", allow(needless_range_loop))] + #[allow(clippy::needless_range_loop)] for di in 0..2 { for dj in 0..2 { for dk in 0..2 { c[di][dj][dk] = self.ran_vec[self.perm_x[(i + di) & 255] - ^ self.perm_y[(j + dj) & 255] - ^ self.perm_z[(k + dk) & 255]] + ^ self.perm_y[(j + dj) & 255] + ^ self.perm_z[(k + dk) & 255]] } } } diff --git a/rtiow/src/rect.rs b/rtiow/src/rect.rs index 9f011d6..1f34c1b 100644 --- a/rtiow/src/rect.rs +++ b/rtiow/src/rect.rs @@ -1,5 +1,5 @@ // There are many math functions in this file, so we allow single letter variable names. -#![cfg_attr(feature = "cargo-clippy", allow(many_single_char_names))] +#![allow(clippy::many_single_char_names)] use crate::aabb::AABB; use crate::hitable::Hit; use crate::hitable::HitRecord; diff --git a/rtiow/src/texture/mandelbrot.rs b/rtiow/src/texture/mandelbrot.rs index 5ba3c55..50dd944 100644 --- a/rtiow/src/texture/mandelbrot.rs +++ b/rtiow/src/texture/mandelbrot.rs @@ -1,3 +1,4 @@ +#![allow(clippy::many_single_char_names)] use rand; use rand::Rng;