From d0b62e56fb5ea1e7d49d0d48779a65c86b9f8ef8 Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Fri, 23 Oct 2026 16:50:12 +0430 Subject: [PATCH] Smart Guides: the Distance Guides tests pass clippy's type-complexity lint --- crates/tools/src/select.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/tools/src/select.rs b/crates/tools/src/select.rs index 09c3bbd3b..3eb8e60fe 100644 --- a/crates/tools/src/select.rs +++ b/crates/tools/src/select.rs @@ -1172,16 +1172,18 @@ mod tests { ev(kind, x, y).with_mods(Mods { alt: true, ..Mods::default() }) } - /// The Distance Guides overlays: each measured line (its ends and label), and the dashed - /// lines out to it, in order. - fn distances(t: &SelectionTool, cx: &ToolContext) -> (Vec<(Point, Point, String)>, Vec<(Point, Point)>) { + /// A Distance Guides measured line: its ends and its label. + type DistanceLine = (Point, Point, String); + + /// The Distance Guides overlays: each measured line, and the dashed lines out to it, in order. + fn distances(t: &SelectionTool, cx: &ToolContext) -> (Vec, Vec<(Point, Point)>) { let o = t.overlays(cx); let lines = o.iter().filter_map(|o| if let Overlay::Distance { a, b, text, .. } = o { Some((*a, *b, text.clone())) } else { None }); let dashed = o.iter().filter_map(|o| if let Overlay::Line { a, b, dashed: true, .. } = o { Some((*a, *b)) } else { None }); (lines.collect(), dashed.collect()) } - fn line(a: (f64, f64), b: (f64, f64), text: &str) -> (Point, Point, String) { + fn line(a: (f64, f64), b: (f64, f64), text: &str) -> DistanceLine { (Point::new(a.0, a.1), Point::new(b.0, b.1), text.to_string()) }