From 50d976e1e6b92ab3633d6c8cc174268e5e6ffef9 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 24 Oct 2026 02:03:48 -0400 Subject: [PATCH] style: keep paint.rs spot-colour chain under rustfmt's max width (#3940) * style: wrap long spot-colour fallback chain to satisfy rustfmt * fix(brush): replace negated partial-ord comparison (clippy 1.99) --- crates/affinity/src/paint.rs | 5 ++++- crates/brush/src/track.rs | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/affinity/src/paint.rs b/crates/affinity/src/paint.rs index 9324b0335..8f9e424aa 100644 --- a/crates/affinity/src/paint.rs +++ b/crates/affinity/src/paint.rs @@ -181,7 +181,10 @@ fn color_within(r: &mut Reader, id: ObjId, depth: u32) -> Option { if depth >= MAX_SPOT_CHAIN { return None; } - return s.obj(id, b"srgb").and_then(|c| color_within(r, c, depth + 1)).or_else(|| s.obj(id, b"base").and_then(|c| color_within(r, c, depth + 1))); + return s + .obj(id, b"srgb") + .and_then(|c| color_within(r, c, depth + 1)) + .or_else(|| s.obj(id, b"base").and_then(|c| color_within(r, c, depth + 1))); } b"RegC" => Color::Cmyk { c: 1.0, m: 1.0, y: 1.0, k: 1.0, a: 1.0 }, _ => { diff --git a/crates/brush/src/track.rs b/crates/brush/src/track.rs index 9e651a670..85ccbd990 100644 --- a/crates/brush/src/track.rs +++ b/crates/brush/src/track.rs @@ -171,7 +171,9 @@ pub fn tracks(bp: &BezPath, tol: f64) -> Vec { // Far outside any drawing a curve flattens to millions of points; past a few million, the // rest are not kept. let b = bp.control_box(); - if !(b.x0.abs().max(b.x1.abs()).max(b.y0.abs()).max(b.y1.abs()) <= 1e9) { + let extent = b.x0.abs().max(b.x1.abs()).max(b.y0.abs()).max(b.y1.abs()); + // NaN coordinates must be rejected too, so keep the negation of the `<=` check. + if extent.is_nan() || extent > 1e9 { return out; } let mut els = vec![];