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:
@@ -36,7 +36,6 @@ use crate::game_plugin::GameMutation;
|
||||
use crate::input_plugin::TouchDragSet;
|
||||
use crate::layout::HUD_BAND_HEIGHT;
|
||||
use crate::layout::LayoutSystem;
|
||||
#[cfg(target_os = "android")]
|
||||
use crate::pause_plugin::PausedResource;
|
||||
use crate::platform::{SHOW_KEYBOARD_ACCELERATORS, USE_TOUCH_UI_LAYOUT};
|
||||
use crate::progress_plugin::ProgressResource;
|
||||
@@ -174,7 +173,7 @@ pub enum HudVisibility {
|
||||
#[cfg(target_os = "android")]
|
||||
#[derive(Resource, Debug, Default)]
|
||||
struct HudTapTracker {
|
||||
start_pos: Option<bevy::math::Vec2>,
|
||||
start_pos: Option<Vec2>,
|
||||
/// Set `true` when the finger-down hit an action button so the
|
||||
/// finger-up never toggles bar visibility.
|
||||
started_on_button: bool,
|
||||
@@ -529,7 +528,7 @@ impl Plugin for HudPlugin {
|
||||
#[cfg(target_os = "android")]
|
||||
{
|
||||
app.init_resource::<HudTapTracker>()
|
||||
.add_message::<bevy::input::touch::TouchInput>()
|
||||
.add_message::<TouchInput>()
|
||||
.add_systems(
|
||||
Update,
|
||||
toggle_hud_on_tap
|
||||
@@ -1140,7 +1139,7 @@ fn handle_help_button(
|
||||
|
||||
fn handle_hint_button(
|
||||
interaction_query: Query<&Interaction, (With<HintButton>, Changed<Interaction>)>,
|
||||
paused: Option<Res<crate::PausedResource>>,
|
||||
paused: Option<Res<PausedResource>>,
|
||||
game: Option<Res<GameStateResource>>,
|
||||
solver_config: Option<Res<crate::input_plugin::HintSolverConfig>>,
|
||||
mut pending_hint: Option<ResMut<crate::pending_hint::PendingHintTask>>,
|
||||
@@ -2658,8 +2657,9 @@ fn resize_action_bar_labels(
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn toggle_hud_on_tap(
|
||||
mut touch_events: MessageReader<bevy::input::touch::TouchInput>,
|
||||
mut touch_events: MessageReader<TouchInput>,
|
||||
drag: Res<DragState>,
|
||||
scrims: Query<(), With<ModalScrim>>,
|
||||
paused: Option<Res<PausedResource>>,
|
||||
@@ -2697,13 +2697,14 @@ fn toggle_hud_on_tap(
|
||||
// regardless of whether we toggle.
|
||||
let on_button = tracker.started_on_button || game_consumed.0;
|
||||
game_consumed.0 = false;
|
||||
if let Some(start) = tracker.start_pos.take() {
|
||||
if !on_button && (event.position - start).length() < HUD_TAP_SLOP_PX {
|
||||
*hud_vis = match *hud_vis {
|
||||
HudVisibility::Visible => HudVisibility::Hidden,
|
||||
HudVisibility::Hidden => HudVisibility::Visible,
|
||||
};
|
||||
}
|
||||
if let Some(start) = tracker.start_pos.take()
|
||||
&& !on_button
|
||||
&& (event.position - start).length() < HUD_TAP_SLOP_PX
|
||||
{
|
||||
*hud_vis = match *hud_vis {
|
||||
HudVisibility::Visible => HudVisibility::Hidden,
|
||||
HudVisibility::Hidden => HudVisibility::Visible,
|
||||
};
|
||||
}
|
||||
tracker.started_on_button = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user