From 7ddcd8992802dbdb0e72549a8f135f7477a51090 Mon Sep 17 00:00:00 2001 From: Paris DOUADY Date: Thu, 4 Jan 2024 11:59:38 +0100 Subject: [PATCH] clippy --- engine/src/drawables/lit_mesh.rs | 3 +-- engine/src/meshload.rs | 2 +- geom/src/heightmap.rs | 3 ++- simulation/src/utils/rand_provider.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engine/src/drawables/lit_mesh.rs b/engine/src/drawables/lit_mesh.rs index a989c7c9..38454f96 100644 --- a/engine/src/drawables/lit_mesh.rs +++ b/engine/src/drawables/lit_mesh.rs @@ -36,8 +36,7 @@ pub fn screen_coverage(gfx: &GfxContext, s: Sphere) -> f32 { let proj_radius2 = (proj_center_side - proj_center).mag2(); - let screen_area = proj_radius2 * std::f32::consts::PI; - screen_area + proj_radius2 * std::f32::consts::PI } #[derive(Clone, Copy, Hash)] diff --git a/engine/src/meshload.rs b/engine/src/meshload.rs index 29acb5e6..97cf2475 100644 --- a/engine/src/meshload.rs +++ b/engine/src/meshload.rs @@ -277,7 +277,7 @@ pub fn find_nodes<'a>( let coverage = v.get("screencoverage").map(|v| { v.as_array() .unwrap() - .into_iter() + .iter() .map(|v| v.as_f64().unwrap()) .collect::>() }); diff --git a/geom/src/heightmap.rs b/geom/src/heightmap.rs index 85139836..7ef25195 100644 --- a/geom/src/heightmap.rs +++ b/geom/src/heightmap.rs @@ -804,7 +804,8 @@ mod erosion { } for c in &changed { - self.get_chunk_mut(*c).map(|c| c.update_max_height()); + let Some(c) = self.get_chunk_mut(*c) else { continue; }; + c.update_max_height(); } changed.into_iter().collect() diff --git a/simulation/src/utils/rand_provider.rs b/simulation/src/utils/rand_provider.rs index e6064b03..41ea7132 100644 --- a/simulation/src/utils/rand_provider.rs +++ b/simulation/src/utils/rand_provider.rs @@ -91,9 +91,9 @@ impl RandProvider { // used only for the initial seed fn splitmix64(state: &mut u64) -> u64 { - *state = state.wrapping_add(0x9E3779B97f4A7C15); + *state = state.wrapping_add(0x9E3779B97F4A7C15); let mut result = *state; result = (result ^ (result >> 30)).wrapping_mul(0xBF58476D1CE4E5B9); result = (result ^ (result >> 27)).wrapping_mul(0x94D049BB133111EB); - return result ^ (result >> 31); + result ^ (result >> 31) }