diff --git a/.gitea/workflows/build-and-test.yml b/.gitea/workflows/build-and-test.yml index 3a2c4ca8..2645848d 100644 --- a/.gitea/workflows/build-and-test.yml +++ b/.gitea/workflows/build-and-test.yml @@ -84,21 +84,18 @@ jobs: cd src-tauri cargo fmt --all -- --check - # ⚠️ Advisory for now — clippy warnings do NOT fail this job yet. + # Clippy is a hard gate. It was advisory while the tree carried a warning + # backlog; that backlog is gone (0 warnings on 1.97.1, the pinned + # toolchain), so a warning here is now new breakage rather than old noise. # - # The tree carries ~51 pre-existing warnings; adding `-D warnings` today - # would paint CI red on unrelated work. A compile *error* still fails the - # step, so this is not a no-op: it stops new breakage and surfaces the - # backlog in every run. - # - # TODO: once the existing warnings are cleared, tighten this to - # cargo clippy --all-targets -- -D warnings - # Flip that flag — do not delete the step. Track progress with - # `cd src-tauri && cargo clippy --all-targets 2>&1 | grep -c '^warning'`. - - name: Run clippy (advisory) + # This only means anything because src-tauri/rust-toolchain.toml pins the + # compiler: clippy's lint set moves between releases, so an unpinned gate + # would fail on whatever the runner happened to install. The pin and this + # flag stand or fall together — if you unpin, drop this back to advisory. + - name: Run clippy run: | cd src-tauri - cargo clippy --all-targets + cargo clippy --all-targets -- -D warnings - name: Run Rust tests run: | diff --git a/src-tauri/src/commands/download/smart_cache.rs b/src-tauri/src/commands/download/smart_cache.rs index 8e2f61f1..c8629d9c 100644 --- a/src-tauri/src/commands/download/smart_cache.rs +++ b/src-tauri/src/commands/download/smart_cache.rs @@ -187,7 +187,7 @@ pub async fn get_album_recommendations( } // Sort by tracks played (descending) - recommendations.sort_by(|a, b| b.tracks_played.cmp(&a.tracks_played)); + recommendations.sort_by_key(|r| std::cmp::Reverse(r.tracks_played)); Ok(recommendations) } @@ -224,7 +224,7 @@ pub fn get_album_affinity_status( .collect(); // Sort by play count (descending) - statuses.sort_by(|a, b| b.unique_tracks_played.cmp(&a.unique_tracks_played)); + statuses.sort_by_key(|s| std::cmp::Reverse(s.unique_tracks_played)); Ok(statuses) } diff --git a/src-tauri/src/repository/offline.rs b/src-tauri/src/repository/offline.rs index 9c24725c..08969892 100644 --- a/src-tauri/src/repository/offline.rs +++ b/src-tauri/src/repository/offline.rs @@ -1128,7 +1128,7 @@ impl OfflineRepository { let device_total_bytes: i64 = leaves.iter().map(|(_, b)| *b).sum(); let mut sizes = std::collections::HashMap::new(); - for (id, bytes) in leaves.into_iter().chain(containers.into_iter()) { + for (id, bytes) in leaves.into_iter().chain(containers) { // A container id can never collide with a leaf id, so a plain insert // is fine; use entry to be defensive against duplicate rows. *sizes.entry(id).or_insert(0) += bytes;