From 7a0dd93f3ee46b78f3c78520e7588e8018b46951 Mon Sep 17 00:00:00 2001 From: Frank Stellmacher <171614930+Psychotoxical@users.noreply.github.com> Date: Sat, 9 May 2026 23:34:23 +0200 Subject: [PATCH] fix(refactor): cfg-gate two items so macOS build is warning-clean (#530) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mac smoke build surfaced 5 dead-code / unused-import warnings, all cfg-leaks of items that are conditionally compiled on Windows + Linux: - `psysonic-audio::power_resume` is consumed by `power_notify_win` and `power_notify_linux` only — `register_post_sleep_audio_recovery` intentionally falls through to a no-op on macOS (the generic device watcher covers the resume case there). Gate the module declaration to `#[cfg(any(target_os = "windows", target_os = "linux"))]`. - `lib_commands::ui::build_mini_player_window` is re-exported for the Windows-only pre-create path in `lib.rs:setup` (other platforms create the mini-player webview lazily on first invoke). Gate the re-export to `#[cfg(target_os = "windows")]` so non-Windows builds don't warn on an unused import. Both are non-functional — the items themselves are already correctly scoped via cfg in their consumers; only the declarations / re-exports were missing the matching gate. --- src-tauri/crates/psysonic-audio/src/lib.rs | 1 + src-tauri/src/lib_commands/ui/mod.rs | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src-tauri/crates/psysonic-audio/src/lib.rs b/src-tauri/crates/psysonic-audio/src/lib.rs index 26f7b4db..8bcb7137 100644 --- a/src-tauri/crates/psysonic-audio/src/lib.rs +++ b/src-tauri/crates/psysonic-audio/src/lib.rs @@ -20,6 +20,7 @@ pub mod radio_commands; pub mod transport_commands; mod device_watcher; mod engine; +#[cfg(any(target_os = "windows", target_os = "linux"))] mod power_resume; #[cfg(target_os = "windows")] mod power_notify_win; diff --git a/src-tauri/src/lib_commands/ui/mod.rs b/src-tauri/src/lib_commands/ui/mod.rs index d7bd7858..77fedb2f 100644 --- a/src-tauri/src/lib_commands/ui/mod.rs +++ b/src-tauri/src/lib_commands/ui/mod.rs @@ -1,8 +1,14 @@ mod mini; pub(crate) use mini::{ - build_mini_player_window, close_mini_player, open_mini_player, pause_rendering, - persist_mini_pos_throttled, preload_mini_player, resize_mini_player, resume_rendering, - set_mini_player_always_on_top, show_main_window, PAUSE_RENDERING_JS, RESUME_RENDERING_JS, + close_mini_player, open_mini_player, pause_rendering, persist_mini_pos_throttled, + preload_mini_player, resize_mini_player, resume_rendering, set_mini_player_always_on_top, + show_main_window, PAUSE_RENDERING_JS, RESUME_RENDERING_JS, }; +// Pre-create-on-startup is a Windows-only path (see `lib.rs:setup`); other +// platforms create the mini-player webview lazily on first invoke. The +// re-export is gated to match so non-Windows builds don't warn on an +// unused import. +#[cfg(target_os = "windows")] +pub(crate) use mini::build_mini_player_window; // Bandsintown moved to psysonic-integration; lib.rs uses the full path.