diff --git a/crates/libremetaverse-prim-mesher/src/prim_mesher.rs b/crates/libremetaverse-prim-mesher/src/prim_mesher.rs index 142779c..e810353 100644 --- a/crates/libremetaverse-prim-mesher/src/prim_mesher.rs +++ b/crates/libremetaverse-prim-mesher/src/prim_mesher.rs @@ -856,10 +856,10 @@ impl Profile { for f in &mut self.faces { std::mem::swap(&mut f.v1, &mut f.v3); } - if self.calc_vertex_normals { - if let Some(n) = self.vertex_normals.last_mut() { - n.z = -n.z; - } + if self.calc_vertex_normals + && let Some(n) = self.vertex_normals.last_mut() + { + n.z = -n.z; } self.face_normal.x = -self.face_normal.x; self.face_normal.y = -self.face_normal.y; diff --git a/crates/libremetaverse-prim-mesher/src/sculpt.rs b/crates/libremetaverse-prim-mesher/src/sculpt.rs index d5be5d4..abfb4cf 100644 --- a/crates/libremetaverse-prim-mesher/src/sculpt.rs +++ b/crates/libremetaverse-prim-mesher/src/sculpt.rs @@ -251,7 +251,7 @@ impl SculptMesh { } let original_width = rows[0].len(); if sculpt_type != SculptMeshSculptType::Plane { - if rows.len() % 2 == 0 { + if rows.len().is_multiple_of(2) { for row in &mut rows { row.push(row[0]); } @@ -264,7 +264,7 @@ impl SculptMesh { let top_pole = rows[0][original_width / 2]; let bottom_pole = rows[rows.len() - 1][original_width / 2]; if sculpt_type == SculptMeshSculptType::Sphere { - if rows.len() % 2 == 0 { + if rows.len().is_multiple_of(2) { let count = rows[0].len(); rows.insert(0, vec![top_pole; count]); rows.push(vec![bottom_pole; count]); diff --git a/crates/libremetaverse-types/src/collections.rs b/crates/libremetaverse-types/src/collections.rs index 09988b2..27d8f2b 100644 --- a/crates/libremetaverse-types/src/collections.rs +++ b/crates/libremetaverse-types/src/collections.rs @@ -1213,10 +1213,10 @@ impl TokenBucket { if state.content.wrapping_sub(amount) < 0 { return Ok(false); } - if let Some(parent) = &self.parent { - if !parent.remove_tokens_with_int32(amount)? { - return Ok(false); - } + if let Some(parent) = &self.parent + && !parent.remove_tokens_with_int32(amount)? + { + return Ok(false); } state.content = state.content.wrapping_sub(amount); Ok(true)