fix: resolve all Rust warnings in qbz-nix crate

- Remove unused import TagExt in library/commands.rs
- Remove unnecessary unsafe block in alsa_direct.rs
- Fix value-never-read warnings in search.rs blacklist filtering
- Handle unused Result from chromecast.disconnect() in lib.rs
- Add #[allow(dead_code)] to unused but intentional API:
  - VECTOR_TTL_SECS constant (future use)
  - PipeWireBackend host field (stored for future use)
  - AlsaDirectStream is_playing field (future use)
  - CacheEntry track_id field (debug purposes)
  - CastSession app_id field (deserialized but unused)
  - ItunesAlbumResult struct (deserialized response)
  - ReleaseDetails struct (Discogs API response)
  - simple_hash function (utility for future use)
  - LrclibItem struct (lyrics API response)
  - AudioSpecs/AudioMetadata structs (future use)
  - Player visualizer_tap field (future feature)
  - Retry constants (future retry logic)
  - PlaybackEngine position/duration/is_alsa_direct methods

Remaining warnings are in vendor/rodio (external code).
This commit is contained in:
vicrodh committed 2026-02-02 22:09:41 -06:00
1 parent 1540146df6
commit 678693d0c4
25 files changed
+58 -48

No files matched your search

+8 -2
View File
@@ -22,7 +22,7 @@ use std::sync::mpsc::{self, Sender, RecvTimeoutError};
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::{Duration, Instant};
use rodio::{Decoder, OutputStream, Sink, Source};
use rodio::{Decoder, OutputStream, Source};
use rodio::buffer::SamplesBuffer;
use rodio::decoder::Mp4Type;
use rodio::cpal::traits::{DeviceTrait, HostTrait};
@@ -110,6 +110,7 @@ impl Seek for CursorMediaSource {
}
/// Audio specifications extracted from decoded audio
#[allow(dead_code)]
struct AudioSpecs {
samples: SamplesBuffer<i16>,
sample_rate: u32,
@@ -201,12 +202,14 @@ fn is_isomp4(data: &[u8]) -> bool {
/// Extract audio metadata (sample rate, channels) without full decode.
/// This is much faster than decode_with_symphonia as it only reads headers.
/// Audio metadata extracted from file headers
#[allow(dead_code)]
struct AudioMetadata {
sample_rate: u32,
channels: u16,
bit_depth: Option<u32>,
}
#[allow(dead_code)]
fn extract_audio_metadata(data: &[u8]) -> Result<(u32, u16), String> {
let meta = extract_audio_metadata_full(data)?;
Ok((meta.sample_rate, meta.channels))
@@ -642,6 +645,7 @@ pub struct Player {
/// Audio settings (exclusive mode, DAC passthrough, etc.)
audio_settings: Arc<Mutex<AudioSettings>>,
/// Visualizer tap for audio sample capture (optional)
#[allow(dead_code)]
visualizer_tap: Option<VisualizerTap>,
}
@@ -790,7 +794,9 @@ impl Player {
let mut current_sample_rate: Option<u32> = None;
let mut current_channels: Option<u16> = None;
#[allow(dead_code)]
const MAX_INIT_RETRIES: u32 = 5;
#[allow(dead_code)]
const RETRY_DELAY_MS: u64 = 500;
let mut current_engine: Option<PlaybackEngine> = None;
@@ -808,7 +814,7 @@ impl Player {
log::info!("Audio thread ready and waiting for commands");
let mut handle_command = |command: AudioCommand,
let handle_command = |command: AudioCommand,
current_engine: &mut Option<PlaybackEngine>,
current_audio_data: &mut Option<Vec<u8>>,
current_streaming_source: &mut Option<Arc<BufferedMediaSource>>,
+4 -1
View File
@@ -7,7 +7,7 @@
//! This abstraction allows the player to work with both approaches transparently.
use crate::audio::AlsaDirectStream;
use rodio::{OutputStream, OutputStreamHandle, Sink, Source};
use rodio::{OutputStreamHandle, Sink, Source};
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use std::sync::Arc;
use std::thread;
@@ -270,6 +270,7 @@ impl PlaybackEngine {
}
/// Get current position in seconds (for ALSA Direct only)
#[allow(dead_code)]
pub fn position_secs(&self) -> Option<u64> {
match self {
Self::Rodio { .. } => None, // Rodio doesn't expose position directly
@@ -286,6 +287,7 @@ impl PlaybackEngine {
}
/// Get duration in seconds (for ALSA Direct only)
#[allow(dead_code)]
pub fn duration_secs(&self) -> Option<u64> {
match self {
Self::Rodio { .. } => None,
@@ -302,6 +304,7 @@ impl PlaybackEngine {
}
/// Check if using ALSA Direct engine
#[allow(dead_code)]
pub fn is_alsa_direct(&self) -> bool {
matches!(self, Self::AlsaDirect { .. })
}