From 6bcf483cfb448f073523efba637377a7ebcf6786 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 25 Nov 2026 05:19:15 -0800 Subject: [PATCH] ui-contract: gate the suite trials' Layer re-export and lookup count on suite The `svg_set::Layer` re-export and the `made_lookups` counter were gated on `testing`, but their only readers, the icon and host key trials, are gated on `suite`. A build with `testing` alone, which craft-ui-test-kit turns on, left both unused, so `cargo clippy -p craft-ui-test-kit --all-targets -- -D warnings` failed on an unused import and a function that is never used. --- crates/ui-contract/src/primitives/mod.rs | 2 +- crates/ui-contract/src/runtime/pointer.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/ui-contract/src/primitives/mod.rs b/crates/ui-contract/src/primitives/mod.rs index 3df36f813..9e820fbbe 100644 --- a/crates/ui-contract/src/primitives/mod.rs +++ b/crates/ui-contract/src/primitives/mod.rs @@ -60,7 +60,7 @@ pub use state_layer::{StateLayer, StateLayerKind}; pub(crate) use surface::{Frames as SurfaceFrames, SurfaceSlot, fit_to_frame}; pub use surface::{Surface, frame_surfaces}; pub use surround::paint_surround; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) use svg_set::Layer; pub use svg_set::{AppIcons, register_app_icons}; pub use text::{ChordText, HAlign, LayoutRun, LeastLayout, ReadingMeasure, Span, TextLayout, TextRun, Wrap}; diff --git a/crates/ui-contract/src/runtime/pointer.rs b/crates/ui-contract/src/runtime/pointer.rs index 58539fbe3..7fc8b9f3b 100644 --- a/crates/ui-contract/src/runtime/pointer.rs +++ b/crates/ui-contract/src/runtime/pointer.rs @@ -254,7 +254,7 @@ pub(crate) struct Shapes { #[cfg(feature = "testing")] resolutions: u32, /// The `made_by_component` lookups the running pass made, for the count trials. - #[cfg(feature = "testing")] + #[cfg(feature = "suite")] made_lookups: u32, } @@ -388,6 +388,9 @@ pub(crate) fn begin(ctx: &Context, hit: HitSizes, latched: craft_keymap::Mods) { #[cfg(feature = "testing")] { shapes.resolutions = 0; + } + #[cfg(feature = "suite")] + { shapes.made_lookups = 0; } }); @@ -858,7 +861,7 @@ pub(crate) fn registered_widgets(ctx: &Context) -> std::collections::HashSet /// editor part, in the running pass of `viewport`. pub(crate) fn made_by_component(ctx: &Context, viewport: ViewportId, id: Id) -> bool { PerViewport::::with(ctx, viewport, |record| { - #[cfg(feature = "testing")] + #[cfg(feature = "suite")] { record.made_lookups += 1; } @@ -867,7 +870,7 @@ pub(crate) fn made_by_component(ctx: &Context, viewport: ViewportId, id: Id) -> } /// How many `made_by_component` lookups the running pass of `viewport` made so far, for the count trials. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) fn made_lookups(ctx: &Context, viewport: ViewportId) -> u32 { PerViewport::::with(ctx, viewport, |record| record.made_lookups) }