From fd5490dc3bb1ee10991b1b0ffa55365592cbb0e7 Mon Sep 17 00:00:00 2001 From: aiongg Date: Mon, 16 Nov 2026 02:05:24 +0000 Subject: [PATCH] craft-ui-widgets: lints the gate denies (redundant must_use on builder setters, a Paint alias for the picture's painter, the test rows' type, the removed veil named) --- crates/ui-widgets/src/bars/lead.rs | 2 -- crates/ui-widgets/src/display/picture.rs | 5 ++++- crates/ui-widgets/src/tabs/document.rs | 2 -- crates/ui-widgets/tests/it/disabled_fade.rs | 2 +- crates/ui-widgets/tests/it/text/zoom_field.rs | 3 ++- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/ui-widgets/src/bars/lead.rs b/crates/ui-widgets/src/bars/lead.rs index 65133c49f..5a2dc7cd9 100644 --- a/crates/ui-widgets/src/bars/lead.rs +++ b/crates/ui-widgets/src/bars/lead.rs @@ -26,7 +26,6 @@ impl<'a> BarHome<'a> { } /// Whether the button takes input; it is enabled by default. - #[must_use] pub fn enabled(mut self, on: bool) -> Self { self.enabled = on; self @@ -74,7 +73,6 @@ impl BarTool { } /// Whether the icon takes input; it is enabled by default. The arrow draws in the disabled look with it. - #[must_use] pub fn enabled(mut self, on: bool) -> Self { self.enabled = on; self diff --git a/crates/ui-widgets/src/display/picture.rs b/crates/ui-widgets/src/display/picture.rs index 58c2fd6a7..dbd617fb8 100644 --- a/crates/ui-widgets/src/display/picture.rs +++ b/crates/ui-widgets/src/display/picture.rs @@ -36,12 +36,15 @@ pub struct PictureStyle { height: f32, } +/// A content painter that paints into the picture's rect. +type Paint<'a> = Box; + /// Where a picture's content comes from. enum Source<'a> { /// Pixels the caller makes, stored as a texture under `key`. Image { key: u64, image: &'a dyn Fn() -> ColorImage }, /// A content painter that paints into the picture's rect. - Painter(Box), + Painter(Paint<'a>), } /// A picture of an image the caller makes (`new`) or of what a content painter paints (`painter`); both sit in a rect diff --git a/crates/ui-widgets/src/tabs/document.rs b/crates/ui-widgets/src/tabs/document.rs index 57050be9a..e09de027c 100644 --- a/crates/ui-widgets/src/tabs/document.rs +++ b/crates/ui-widgets/src/tabs/document.rs @@ -196,14 +196,12 @@ impl<'a, D: Clone + Eq + Hash + Send + Sync + std::fmt::Debug + 'static> Documen } /// Every tab takes the strip's taller form. - #[must_use] pub fn large(mut self, on: bool) -> Self { self.large = on; self } /// The strip takes files dragged from the operating system and reports them as `FilesDropped`. - #[must_use] pub fn takes_files(mut self, on: bool) -> Self { self.takes_files = on; self diff --git a/crates/ui-widgets/tests/it/disabled_fade.rs b/crates/ui-widgets/tests/it/disabled_fade.rs index 92b4dfc82..9a93c6c02 100644 --- a/crates/ui-widgets/tests/it/disabled_fade.rs +++ b/crates/ui-widgets/tests/it/disabled_fade.rs @@ -108,7 +108,7 @@ fn a_disabled_faded_component_paints_its_enabled_look_faded_once() { "the veil is painted after the tile's last shape" ); let mut own = disabled.clone(); - own.remove(veil); + let _veil = own.remove(veil); let (own, enabled) = (colors(&own), colors(&enabled)); assert_eq!(own, enabled, "under the veil the disabled tile paints its enabled colours"); let painting = own.iter().filter(|shape| shape.iter().any(|color| color.a() > 0)).count(); diff --git a/crates/ui-widgets/tests/it/text/zoom_field.rs b/crates/ui-widgets/tests/it/text/zoom_field.rs index 94b302956..e94c67216 100644 --- a/crates/ui-widgets/tests/it/text/zoom_field.rs +++ b/crates/ui-widgets/tests/it/text/zoom_field.rs @@ -172,7 +172,8 @@ fn close(a: f64, b: f64) -> bool { #[trial] fn the_zoom_field_reads_ratios_and_one_separator_and_refuses_the_rest() { use Input::{Pasted, Typed}; - let rows: [(bool, Input, Option<&str>, f64, bool, bool); 10] = [ + type Row = (bool, Input, Option<&'static str>, f64, bool, bool); + let rows: [Row; 10] = [ (false, Typed("045"), Some("45"), 45.0, false, false), (false, Typed("1/2"), Some("50"), 50.0, false, false), (false, Pasted("5/2"), Some("250"), 250.0, false, false),