fix: resolve all Rust test compile warnings without suppression
Some checks failed
🏗️ Build and Test JellyTau / Run Tests (push) Successful in 4m16s
Traceability Validation / Check Requirement Traces (push) Successful in 22s
🏗️ Build and Test JellyTau / Build Android APK (push) Has been cancelled

Remove unused imports and a dead test helper, and strengthen tests that
held unused bindings/fields so the values are actually exercised:
- drop unused imports (HttpConfig, MediaType, std::io::Write)
- remove unused TestEventEmitter::clear helper
- replace meaningless size_of asserts with real empty-manager checks
- assert on MockTrack.name in sorting tests
This commit is contained in:
Duncan Tourolle 2026-06-21 09:33:50 +02:00
parent 60bb6c72d1
commit ccc9dca924
6 changed files with 6 additions and 11 deletions

View File

@ -1796,6 +1796,7 @@ mod tests {
// Test finding track 1 (should be index 0) // Test finding track 1 (should be index 0)
let index1 = tracks.iter().position(|t| t.id == "track1"); let index1 = tracks.iter().position(|t| t.id == "track1");
assert_eq!(index1, Some(0), "Track 1 should be at index 0"); assert_eq!(index1, Some(0), "Track 1 should be at index 0");
assert_eq!(tracks[0].name, "Song 1", "Track at index 0 should carry its name");
// Test finding track 3 (should be index 2) // Test finding track 3 (should be index 2)
let index3 = tracks.iter().position(|t| t.id == "track3"); let index3 = tracks.iter().position(|t| t.id == "track3");
@ -1869,6 +1870,7 @@ mod tests {
// Verify all tracks are in correct order // Verify all tracks are in correct order
assert_eq!(tracks[0].id, "id1"); assert_eq!(tracks[0].id, "id1");
assert_eq!(tracks[0].name, "Track 1", "Sorted track should retain its name");
assert_eq!(tracks[1].id, "id2"); assert_eq!(tracks[1].id, "id2");
assert_eq!(tracks[2].id, "id3"); assert_eq!(tracks[2].id, "id3");
assert_eq!(tracks[3].id, "id4"); assert_eq!(tracks[3].id, "id4");

View File

@ -499,16 +499,16 @@ mod tests {
#[test] #[test]
fn test_repository_manager_creation() { fn test_repository_manager_creation() {
let manager = RepositoryManager::new(); let manager = RepositoryManager::new();
// Should be able to create RepositoryManager without panicking // A freshly created manager holds no repositories
assert_eq!(std::mem::size_of::<RepositoryManager>() > 0, true); assert!(manager.get("any-handle").is_none());
} }
#[test] #[test]
fn test_repository_manager_wrapper_structure() { fn test_repository_manager_wrapper_structure() {
let manager = RepositoryManager::new(); let manager = RepositoryManager::new();
let wrapper = RepositoryManagerWrapper(manager); let wrapper = RepositoryManagerWrapper(manager);
// Verify wrapper holds the manager // The wrapper exposes the underlying manager, which starts empty
assert_eq!(std::mem::size_of::<RepositoryManagerWrapper>() > 0, true); assert!(wrapper.0.get("any-handle").is_none());
} }
#[test] #[test]

View File

@ -349,7 +349,6 @@ impl ConnectivityMonitorHandle {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::jellyfin::http_client::HttpConfig;
#[test] #[test]
fn test_intervals() { fn test_intervals() {

View File

@ -120,7 +120,6 @@ pub struct DownloadTask {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::player::MediaType;
#[test] #[test]
fn test_download_manager_set_max_concurrent() { fn test_download_manager_set_max_concurrent() {

View File

@ -172,10 +172,6 @@ mod tests {
pub fn events(&self) -> Vec<PlayerStatusEvent> { pub fn events(&self) -> Vec<PlayerStatusEvent> {
self.events.lock_safe().clone() self.events.lock_safe().clone()
} }
pub fn clear(&self) {
self.events.lock_safe().clear();
}
} }
impl PlayerEventEmitter for TestEventEmitter { impl PlayerEventEmitter for TestEventEmitter {

View File

@ -344,7 +344,6 @@ mod tests {
use super::*; use super::*;
use crate::storage::db_service::RusqliteService; use crate::storage::db_service::RusqliteService;
use rusqlite::Connection; use rusqlite::Connection;
use std::io::Write;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use tempfile::TempDir; use tempfile::TempDir;