diff --git a/src/accel/bvh4.rs b/src/accel/bvh4.rs index d87d22c..1a90f3a 100644 --- a/src/accel/bvh4.rs +++ b/src/accel/bvh4.rs @@ -64,7 +64,7 @@ impl<'a> BVH4<'a> { where F: 'b + Fn(&T) -> &'b [BBox], { - if objects.len() == 0 { + if objects.is_empty() { BVH4 { root: None, depth: 0, @@ -116,8 +116,8 @@ impl<'a> BVH4<'a> { let mut stack_ptr = 1; while stack_ptr > 0 { - match node_stack[stack_ptr] { - &BVH4Node::Internal { + match *node_stack[stack_ptr] { + BVH4Node::Internal { bounds, children, traversal_code, @@ -143,7 +143,7 @@ impl<'a> BVH4<'a> { rays.max_t(ray_idx), ) }; - all_hits = all_hits | hits; + all_hits |= hits; hits } }); @@ -168,7 +168,7 @@ impl<'a> BVH4<'a> { } } - &BVH4Node::Leaf { object_range } => { + BVH4Node::Leaf { object_range } => { // Do the ray tests. obj_ray_test(object_range.0..object_range.1, rays, ray_stack); @@ -191,12 +191,12 @@ impl<'a> BVH4<'a> { ) -> usize { let mut node_count = 0; - match node { + match *node { // Create internal node - &BVHBaseNode::Internal { - bounds_range: _, + BVHBaseNode::Internal { children_indices, split_axis, + .. } => { let child_l = &base.nodes[children_indices.0]; let child_r = &base.nodes[children_indices.1]; @@ -274,7 +274,7 @@ impl<'a> BVH4<'a> { let bounds_len = children .iter() .map(|c| { - if let &Some(n) = c { + if let Some(n) = *c { let len = n.bounds_range().1 - n.bounds_range().0; debug_assert!(len >= 1); len @@ -345,7 +345,7 @@ impl<'a> BVH4<'a> { } // Create internal node - &BVHBaseNode::Leaf { object_range, .. } => { + BVHBaseNode::Leaf { object_range, .. } => { unsafe { *fill_node.as_mut_ptr() = BVH4Node::Leaf { object_range: object_range, diff --git a/src/bbox4.rs b/src/bbox4.rs index 07cb456..7f80023 100644 --- a/src/bbox4.rs +++ b/src/bbox4.rs @@ -11,7 +11,7 @@ use crate::{ use glam::{Vec4, Vec4Mask}; -const BBOX_MAXT_ADJUST: f32 = 1.00000024; +const BBOX_MAXT_ADJUST: f32 = 1.000_000_24; /// A SIMD set of 4 3D axis-aligned bounding boxes. #[derive(Debug, Copy, Clone)] diff --git a/src/color.rs b/src/color.rs index 891a465..178e47c 100644 --- a/src/color.rs +++ b/src/color.rs @@ -337,8 +337,8 @@ impl Lerp for Color { fn plancks_law(temperature: f32, wavelength: f32) -> f32 { const C: f32 = 299_792_458.0; // Speed of light - const H: f32 = 6.62607015e-34; // Planck constant - const KB: f32 = 1.38064852e-23; // Boltzmann constant + const H: f32 = 6.626_070_15e-34; // Planck constant + const KB: f32 = 1.380_648_52e-23; // Boltzmann constant // At 400 kelvin and below, the spectrum is black anyway, // but the equations become numerically unstable somewhere diff --git a/src/main.rs b/src/main.rs index f469e98..1d77988 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ #![allow(clippy::cast_lossless)] #![allow(clippy::needless_range_loop)] #![allow(clippy::excessive_precision)] +#![allow(clippy::transmute_ptr_to_ptr)] extern crate lazy_static; @@ -57,7 +58,7 @@ use crate::{ const VERSION: &str = env!("CARGO_PKG_VERSION"); -#[allow(clippy::cyclomatic_complexity)] +#[allow(clippy::cognitive_complexity)] fn main() { let mut t = Timer::new(); diff --git a/src/parse/psy.rs b/src/parse/psy.rs index c2d3210..7dded61 100644 --- a/src/parse/psy.rs +++ b/src/parse/psy.rs @@ -580,7 +580,7 @@ pub fn make_transform_format_error(byte_offset: usize) -> PsyParseError { } pub fn parse_color(contents: &str) -> Result { - let items: Vec<_> = contents.split(",").map(|s| s.trim()).collect(); + let items: Vec<_> = contents.split(',').map(|s| s.trim()).collect(); if items.len() != 2 { return Err(PsyParseError::UnknownError(0)); } diff --git a/sub_crates/mem_arena/src/lib.rs b/sub_crates/mem_arena/src/lib.rs index a92db46..6890181 100644 --- a/sub_crates/mem_arena/src/lib.rs +++ b/sub_crates/mem_arena/src/lib.rs @@ -1,6 +1,7 @@ #![allow(clippy::redundant_field_names)] #![allow(clippy::needless_return)] #![allow(clippy::mut_from_ref)] +#![allow(clippy::transmute_ptr_to_ptr)] use std::{ cell::{Cell, RefCell}, diff --git a/sub_crates/spectral_upsampling/src/jakob.rs b/sub_crates/spectral_upsampling/src/jakob.rs index 8a15156..b33f619 100644 --- a/sub_crates/spectral_upsampling/src/jakob.rs +++ b/sub_crates/spectral_upsampling/src/jakob.rs @@ -51,6 +51,7 @@ pub fn aces_to_spectrum_p4(lambdas: Vec4, rgb: (f32, f32, f32)) -> Vec4 { // Core functions, specialized above for specific color spaces. #[inline(always)] +#[allow(clippy::many_single_char_names)] fn small_rgb_to_spectrum_p4( table: &[[(f32, f32, f32); 2]], table_res: usize, diff --git a/sub_crates/spectral_upsampling/src/lib.rs b/sub_crates/spectral_upsampling/src/lib.rs index e45217f..93f0d6f 100644 --- a/sub_crates/spectral_upsampling/src/lib.rs +++ b/sub_crates/spectral_upsampling/src/lib.rs @@ -2,7 +2,7 @@ // clippy warnings that stem from the C code. #![allow(clippy::needless_return)] #![allow(clippy::useless_let_if_seq)] -#![allow(clippy::cyclomatic_complexity)] +#![allow(clippy::cognitive_complexity)] pub mod jakob; pub mod meng; diff --git a/sub_crates/spectral_upsampling/src/meng.rs b/sub_crates/spectral_upsampling/src/meng.rs index bc14eb2..953940e 100644 --- a/sub_crates/spectral_upsampling/src/meng.rs +++ b/sub_crates/spectral_upsampling/src/meng.rs @@ -2,7 +2,7 @@ // clippy warnings that stem from the C code. #![allow(clippy::needless_return)] #![allow(clippy::useless_let_if_seq)] -#![allow(clippy::cyclomatic_complexity)] +#![allow(clippy::cognitive_complexity)] use std::f32; diff --git a/sub_crates/trifloat/src/signed48.rs b/sub_crates/trifloat/src/signed48.rs index 24f4437..5dd99bf 100644 --- a/sub_crates/trifloat/src/signed48.rs +++ b/sub_crates/trifloat/src/signed48.rs @@ -13,6 +13,8 @@ //! All integers in the range `[-8192, 8192]` can be represented exactly in the //! largest value. +#![allow(clippy::cast_lossless)] + use crate::{fiddle_exp2, fiddle_log2}; /// Largest representable number. @@ -27,6 +29,7 @@ pub const MIN: f32 = -274_844_352_512.0; /// Smallest representable positive number. /// /// This is the number with the smallest possible magnitude (aside from zero). +#[allow(clippy::excessive_precision)] pub const MIN_POSITIVE: f32 = 0.000_000_000_003_637_978_807_091_713; /// Difference between 1.0 and the next largest representable number.