style(engine): clear latent android-only clippy warnings in hud_plugin

These six warnings only surfaced on an `aarch64-linux-android` clippy build;
the host workspace gate never compiles the `cfg(target_os = "android")` HUD
tap-toggle code, so they had accumulated unseen.

- unqualify `Vec2` / `TouchInput` (reachable via the bevy prelude) in the
  android tap tracker, plugin wiring, and `toggle_hud_on_tap` signature
- make the `PausedResource` import unconditional and unqualify its use in
  `handle_hint_button` (host-compiled, so the import had been android-gated
  purely to satisfy `toggle_hud_on_tap`)
- allow `clippy::too_many_arguments` on the `toggle_hud_on_tap` Bevy system
- collapse a nested `if let` / `if` into a let-chain

Verified clean on both host `clippy -p solitaire_engine --all-targets
-- -D warnings` and `aarch64-linux-android` clippy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
funman300
2026-06-22 11:39:21 -07:00
parent 9299176b2d
commit e3b8a403ef
+13 -12
View File
@@ -36,7 +36,6 @@ use crate::game_plugin::GameMutation;
use crate::input_plugin::TouchDragSet; use crate::input_plugin::TouchDragSet;
use crate::layout::HUD_BAND_HEIGHT; use crate::layout::HUD_BAND_HEIGHT;
use crate::layout::LayoutSystem; use crate::layout::LayoutSystem;
#[cfg(target_os = "android")]
use crate::pause_plugin::PausedResource; use crate::pause_plugin::PausedResource;
use crate::platform::{SHOW_KEYBOARD_ACCELERATORS, USE_TOUCH_UI_LAYOUT}; use crate::platform::{SHOW_KEYBOARD_ACCELERATORS, USE_TOUCH_UI_LAYOUT};
use crate::progress_plugin::ProgressResource; use crate::progress_plugin::ProgressResource;
@@ -174,7 +173,7 @@ pub enum HudVisibility {
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
#[derive(Resource, Debug, Default)] #[derive(Resource, Debug, Default)]
struct HudTapTracker { struct HudTapTracker {
start_pos: Option<bevy::math::Vec2>, start_pos: Option<Vec2>,
/// Set `true` when the finger-down hit an action button so the /// Set `true` when the finger-down hit an action button so the
/// finger-up never toggles bar visibility. /// finger-up never toggles bar visibility.
started_on_button: bool, started_on_button: bool,
@@ -529,7 +528,7 @@ impl Plugin for HudPlugin {
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
{ {
app.init_resource::<HudTapTracker>() app.init_resource::<HudTapTracker>()
.add_message::<bevy::input::touch::TouchInput>() .add_message::<TouchInput>()
.add_systems( .add_systems(
Update, Update,
toggle_hud_on_tap toggle_hud_on_tap
@@ -1140,7 +1139,7 @@ fn handle_help_button(
fn handle_hint_button( fn handle_hint_button(
interaction_query: Query<&Interaction, (With<HintButton>, Changed<Interaction>)>, interaction_query: Query<&Interaction, (With<HintButton>, Changed<Interaction>)>,
paused: Option<Res<crate::PausedResource>>, paused: Option<Res<PausedResource>>,
game: Option<Res<GameStateResource>>, game: Option<Res<GameStateResource>>,
solver_config: Option<Res<crate::input_plugin::HintSolverConfig>>, solver_config: Option<Res<crate::input_plugin::HintSolverConfig>>,
mut pending_hint: Option<ResMut<crate::pending_hint::PendingHintTask>>, mut pending_hint: Option<ResMut<crate::pending_hint::PendingHintTask>>,
@@ -2658,8 +2657,9 @@ fn resize_action_bar_labels(
} }
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
#[allow(clippy::too_many_arguments)]
fn toggle_hud_on_tap( fn toggle_hud_on_tap(
mut touch_events: MessageReader<bevy::input::touch::TouchInput>, mut touch_events: MessageReader<TouchInput>,
drag: Res<DragState>, drag: Res<DragState>,
scrims: Query<(), With<ModalScrim>>, scrims: Query<(), With<ModalScrim>>,
paused: Option<Res<PausedResource>>, paused: Option<Res<PausedResource>>,
@@ -2697,13 +2697,14 @@ fn toggle_hud_on_tap(
// regardless of whether we toggle. // regardless of whether we toggle.
let on_button = tracker.started_on_button || game_consumed.0; let on_button = tracker.started_on_button || game_consumed.0;
game_consumed.0 = false; game_consumed.0 = false;
if let Some(start) = tracker.start_pos.take() { if let Some(start) = tracker.start_pos.take()
if !on_button && (event.position - start).length() < HUD_TAP_SLOP_PX { && !on_button
*hud_vis = match *hud_vis { && (event.position - start).length() < HUD_TAP_SLOP_PX
HudVisibility::Visible => HudVisibility::Hidden, {
HudVisibility::Hidden => HudVisibility::Visible, *hud_vis = match *hud_vis {
}; HudVisibility::Visible => HudVisibility::Hidden,
} HudVisibility::Hidden => HudVisibility::Visible,
};
} }
tracker.started_on_button = false; tracker.started_on_button = false;
} }