Fix the remaining clippy warnings across the workspace

This commit is contained in:
Dennis Kobert
2026-09-16 01:15:16 +02:00
parent 45d6f1bd39
commit 9bfbc20d87
4 changed files with 7 additions and 8 deletions
@@ -645,7 +645,7 @@ impl<'a> ModifyInputsContext<'a> {
.nodes .nodes
.get(&node_id) .get(&node_id)
.and_then(|node| node.input(graphene_std::math_nodes::gradient_positions::PositionsInput)); .and_then(|node| node.input(graphene_std::math_nodes::gradient_positions::PositionsInput));
if !current_input.is_some_and(|input| input.as_value().is_some()) { if current_input.is_none_or(|input| input.as_value().is_none()) {
return; return;
} }
@@ -669,7 +669,7 @@ impl<'a> ModifyInputsContext<'a> {
.nodes .nodes
.get(&node_id) .get(&node_id)
.and_then(|node| node.input(graphene_std::math_nodes::gradient_midpoints::MidpointsInput)); .and_then(|node| node.input(graphene_std::math_nodes::gradient_midpoints::MidpointsInput));
if !current_input.is_some_and(|input| input.as_value().is_some()) { if current_input.is_none_or(|input| input.as_value().is_none()) {
return; return;
} }
+1 -2
View File
@@ -992,9 +992,8 @@ pub fn sum(_: impl Ctx, values: IList<f64>) -> f64 {
#[node_macro::node(category("Math: Numeric"))] #[node_macro::node(category("Math: Numeric"))]
fn average(_: impl Ctx, values: IList<f64>) -> f64 { fn average(_: impl Ctx, values: IList<f64>) -> f64 {
let count = values.len(); let count = values.len();
let average = if count == 0 { 0. } else { values.iter().sum::<f64>() / count as f64 };
average if count == 0 { 0. } else { values.iter().sum::<f64>() / count as f64 }
} }
/// Gives the smallest number in the input list. An empty list gives 0. /// Gives the smallest number in the input list. An empty list gives 0.
+1 -1
View File
@@ -334,7 +334,7 @@ fn stamp_inherited_appearance(out: &mut List<Vector>, index: usize, inherited: O
fn push_union(out: &mut List<Vector>, flattened: List<Vector>) { fn push_union(out: &mut List<Vector>, flattened: List<Vector>) {
// The union emits one blank operand even from an empty list, which would fabricate a region out of nothing // The union emits one blank operand even from an empty list, which would fabricate a region out of nothing
if flattened.len() == 0 { if flattened.is_empty() {
return; return;
} }
for row in boolean_operation_on_vector_list(&flattened, BooleanOperation::Union).into_iter() { for row in boolean_operation_on_vector_list(&flattened, BooleanOperation::Union).into_iter() {
+3 -3
View File
@@ -4150,7 +4150,7 @@ mod test {
fn voronoi_shared_mesh_has_no_regions() { fn voronoi_shared_mesh_has_no_regions() {
let vector = with_ctx(|ctx| super::voronoi_cells(ctx, vector_from_points(&SQUARE_WITH_CENTER), true).unwrap()); let vector = with_ctx(|ctx| super::voronoi_cells(ctx, vector_from_points(&SQUARE_WITH_CENTER), true).unwrap());
assert_eq!(vector.region_domain.ids().len(), 0); assert_eq!(vector.region_domain.ids().len(), 0);
assert!(vector.segment_domain.ids().len() > 0); assert!(!vector.segment_domain.ids().is_empty());
} }
#[test] #[test]
@@ -4179,8 +4179,8 @@ mod test {
assert_eq!(vector.point_domain.ids().len(), points.len()); assert_eq!(vector.point_domain.ids().len(), points.len());
assert_ne!(vector.point_domain.positions(), &points[..]); assert_ne!(vector.point_domain.positions(), &points[..]);
// The convex-hull corners are pinned. // The convex-hull corners are pinned.
for i in 0..4 { for (corner, &expected) in points.iter().enumerate().take(4) {
assert_eq!(vector.point_domain.positions()[i], points[i], "hull corner {i} should be pinned"); assert_eq!(vector.point_domain.positions()[corner], expected, "hull corner {corner} should be pinned");
} }
for &point in vector.point_domain.positions() { for &point in vector.point_domain.positions() {
assert!(point.x >= -1e-6 && point.x <= 10. + 1e-6); assert!(point.x >= -1e-6 && point.x <= 10. + 1e-6);