mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
Fix the remaining clippy warnings across the workspace
This commit is contained in:
@@ -645,7 +645,7 @@ impl<'a> ModifyInputsContext<'a> {
|
||||
.nodes
|
||||
.get(&node_id)
|
||||
.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;
|
||||
}
|
||||
|
||||
@@ -669,7 +669,7 @@ impl<'a> ModifyInputsContext<'a> {
|
||||
.nodes
|
||||
.get(&node_id)
|
||||
.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;
|
||||
}
|
||||
|
||||
|
||||
@@ -992,9 +992,8 @@ pub fn sum(_: impl Ctx, values: IList<f64>) -> f64 {
|
||||
#[node_macro::node(category("Math: Numeric"))]
|
||||
fn average(_: impl Ctx, values: IList<f64>) -> f64 {
|
||||
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.
|
||||
|
||||
@@ -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>) {
|
||||
// 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;
|
||||
}
|
||||
for row in boolean_operation_on_vector_list(&flattened, BooleanOperation::Union).into_iter() {
|
||||
|
||||
@@ -4150,7 +4150,7 @@ mod test {
|
||||
fn voronoi_shared_mesh_has_no_regions() {
|
||||
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!(vector.segment_domain.ids().len() > 0);
|
||||
assert!(!vector.segment_domain.ids().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -4179,8 +4179,8 @@ mod test {
|
||||
assert_eq!(vector.point_domain.ids().len(), points.len());
|
||||
assert_ne!(vector.point_domain.positions(), &points[..]);
|
||||
// The convex-hull corners are pinned.
|
||||
for i in 0..4 {
|
||||
assert_eq!(vector.point_domain.positions()[i], points[i], "hull corner {i} should be pinned");
|
||||
for (corner, &expected) in points.iter().enumerate().take(4) {
|
||||
assert_eq!(vector.point_domain.positions()[corner], expected, "hull corner {corner} should be pinned");
|
||||
}
|
||||
for &point in vector.point_domain.positions() {
|
||||
assert!(point.x >= -1e-6 && point.x <= 10. + 1e-6);
|
||||
|
||||
Reference in New Issue
Block a user