From 22118a3e8e98e208b08c45bf221490754d7ee294 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 14 Oct 2026 06:44:57 +0700 Subject: [PATCH] Edit Toolbar: the drawer's groups have a named type (clippy's type-complexity) --- crates/ui-egui/src/edit_toolbar.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/edit_toolbar.rs b/crates/ui-egui/src/edit_toolbar.rs index 1138e37b..c2d1c4bf 100644 --- a/crates/ui-egui/src/edit_toolbar.rs +++ b/crates/ui-egui/src/edit_toolbar.rs @@ -375,13 +375,16 @@ fn sections() -> &'static [(&'static str, Vec<&'static ToolInfo>)] { }) } +/// A heading of the drawer and the flyout groups listed under it. +type Heading = (&'static str, Vec<&'static [ToolInfo]>); + /// The headings in order, each with the flyout groups listed under it (a group under the heading /// most of its tools have, the first tool's on a tie), each in its tools' order: what the drawer /// frames together. -fn groups() -> &'static [(&'static str, Vec<&'static [ToolInfo]>)] { - static GROUPS: OnceLock)>> = OnceLock::new(); +fn groups() -> &'static [Heading] { + static GROUPS: OnceLock> = OnceLock::new(); GROUPS.get_or_init(|| { - let mut out: Vec<(&'static str, Vec<&'static [ToolInfo]>)> = sections().iter().map(|(cat, _)| (*cat, vec![])).collect(); + let mut out: Vec = sections().iter().map(|(cat, _)| (*cat, vec![])).collect(); for g in TOOL_GROUPS { let Some(first) = g.first() else { continue }; let count = |h: &str| g.iter().filter(|t| heading(t.id) == h).count();