ci: make clippy a hard gate
The advisory step existed because the tree carried a warning backlog. Measured on 1.97.1 — the pinned toolchain CI actually uses — that backlog is three warnings, not the ~51 the comment claimed: two unnecessary_sort_by in smart_cache and one redundant into_iter in offline. Fixed, so clippy now runs with -D warnings and a warning means new breakage. Worth recording why this took a toolchain pin to do safely: the same tree measured 0 warnings on 1.92.0 and 3 on 1.97.1. Flipping the flag on a local measurement, without the pin, would have reddened CI on the next push. TRACES: | DR-206
This commit is contained in:
@@ -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: |
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user