From bcd543e017f539cfba2293fc8db0d9c08aed9da0 Mon Sep 17 00:00:00 2001 From: aiongg Date: Sat, 14 Nov 2026 01:36:21 +0000 Subject: [PATCH] Lints: ui-patterns tests, gallery, docx docs link --- crates/docx/src/lib.rs | 2 +- crates/ui-gallery/src/lib.rs | 2 +- crates/ui-gallery/src/theme/rows.rs | 2 +- crates/ui-patterns/tests/it/form_dialogs/hosted.rs | 2 +- crates/ui-patterns/tests/it/panels/palette.rs | 6 ++++-- crates/ui-patterns/tests/it/presets/browser.rs | 3 ++- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/docx/src/lib.rs b/crates/docx/src/lib.rs index 7f47d948b..d1dd6721e 100644 --- a/crates/docx/src/lib.rs +++ b/crates/docx/src/lib.rs @@ -1,6 +1,6 @@ //! DOCX reader and writer (ECMA-376 / ISO/IEC 29500 WordprocessingML). //! -//! [`read`] turns a `.docx` package into a [`craft_wordmodel::Document`]; [`write`] does the +//! [`read`] turns a `.docx` package into a [`craft_wordmodel::Document`]; [`fn@write`] does the //! reverse. Both are written from the public specification. The reader is lenient (unknown //! markup is skipped, bad numbers fall back to defaults) and bounded (zip entry sizes, total //! decompressed size, XML depth and element counts are capped), so hostile input yields an diff --git a/crates/ui-gallery/src/lib.rs b/crates/ui-gallery/src/lib.rs index e6a93e7dc..3303bee4b 100644 --- a/crates/ui-gallery/src/lib.rs +++ b/crates/ui-gallery/src/lib.rs @@ -22,8 +22,8 @@ pub const WINDOW: [f32; 2] = [1280.0, 800.0]; /// the story registrations in them, which a release build for the web would otherwise drop. type Registered = fn() -> Vec<&'static craft_ui::testing::Registration>; +#[allow(unused_mut, clippy::vec_init_then_push)] fn crates() -> Vec<(&'static str, Registered)> { - #[allow(unused_mut, clippy::vec_init_then_push)] let mut crates: Vec<(&'static str, Registered)> = Vec::new(); #[cfg(feature = "automation")] crates.push(("craft-automation", craft_automation::testing::registered)); diff --git a/crates/ui-gallery/src/theme/rows.rs b/crates/ui-gallery/src/theme/rows.rs index e3994b9ed..04dd64d24 100644 --- a/crates/ui-gallery/src/theme/rows.rs +++ b/crates/ui-gallery/src/theme/rows.rs @@ -69,7 +69,7 @@ impl Filters { /// Whether a colour token passes. fn keeps_token(&self, explained: &Explained, token: ColorToken, pinned: bool, moved: bool) -> bool { - self.matches_path(&token.path()) + self.matches_path(token.path()) && (!self.pinned || pinned) && (!self.moved || moved) && (!self.failing || explained.pairs_of(token).any(|pair| !pair.pair.passes())) diff --git a/crates/ui-patterns/tests/it/form_dialogs/hosted.rs b/crates/ui-patterns/tests/it/form_dialogs/hosted.rs index 627925cf0..a84cbe16a 100644 --- a/crates/ui-patterns/tests/it/form_dialogs/hosted.rs +++ b/crates/ui-patterns/tests/it/form_dialogs/hosted.rs @@ -22,7 +22,7 @@ fn about() -> HostedAbout { } fn canvas_size() -> HostedCanvasSize { - HostedCanvasSize::new(CanvasSizeValues::new(PICTURE), |values| CanvasSize::new(values)) + HostedCanvasSize::new(CanvasSizeValues::new(PICTURE), CanvasSize::new) } /// A fixture that runs `host` every pass, in a room large enough for every form. diff --git a/crates/ui-patterns/tests/it/panels/palette.rs b/crates/ui-patterns/tests/it/panels/palette.rs index da928c0e0..aab52e026 100644 --- a/crates/ui-patterns/tests/it/panels/palette.rs +++ b/crates/ui-patterns/tests/it/panels/palette.rs @@ -28,13 +28,15 @@ enum TrialCommand { Zoom, } +type PaletteRig = (Fixture, Rc>, Rc>>); + /// A palette open over `entries`, inside a modal dialog when `in_dialog`; `picked` holds the last pick. -fn palette(entries: Vec, in_dialog: bool) -> (Fixture, Rc>, Rc>>) { +fn palette(entries: Vec, in_dialog: bool) -> PaletteRig { let open = Rc::new(Cell::new(true)); let picked = Rc::new(RefCell::new(None::)); let (shown_open, shown_picked) = (open.clone(), picked.clone()); let fixture = Fixture::new(move |ui| { - let mut show = |ui: &mut Ui| { + let show = |ui: &mut Ui| { let mut is_open = shown_open.get(); let output = CommandPalette::new("Commands", &entries, Bind::bound(&mut is_open)).show(ui); shown_open.set(is_open); diff --git a/crates/ui-patterns/tests/it/presets/browser.rs b/crates/ui-patterns/tests/it/presets/browser.rs index b8b05c384..2d70ca923 100644 --- a/crates/ui-patterns/tests/it/presets/browser.rs +++ b/crates/ui-patterns/tests/it/presets/browser.rs @@ -36,7 +36,8 @@ fn rig() -> (Fixture, Rc>>>) { #[trial] fn a_preset_released_over_the_zone_reports_drop_at_and_nothing_else_does() { // (row grabbed, release point, the drop reported) - let cases: [(&str, Pos2, Option<(u32, Pos2)>); 4] = [ + type Case = (&'static str, Pos2, Option<(u32, Pos2)>); + let cases: [Case; 4] = [ ("Alpha", pos2(360.0, 100.0), Some((ALPHA, pos2(360.0, 100.0)))), ("Alpha", pos2(360.0, 240.0), None), ("Alpha", pos2(230.0, 100.0), None),