fix(clippy): Rust 1.95 compatibility — sort_by_key + collapsible_match

CI runs on stable Rust which advanced from 1.93 to 1.95, introducing
two newly-enforced lints under -D warnings:

- clippy::unnecessary_sort_by (12 sites) — rewrite sort_by closures
  that only call .cmp on Copy keys as sort_by_key, using std::cmp::Reverse
  for the descending ones.
- clippy::collapsible_match (1 site) — merge the MemoryState::Dormant
  inner if into a match guard. The equivalent rewrite for the Ping/Pong
  arm in websocket.rs is blocked by a move of non-Copy Bytes across the
  match-guard boundary, so that one site gets an explicit #[allow].

Files touched:
- crates/vestige-core/src/advanced/{chains,compression,cross_project,reconsolidation}.rs
- crates/vestige-core/src/codebase/{git,relationships}.rs
- crates/vestige-core/src/neuroscience/{importance_signals,memory_states,predictive_retrieval}.rs
- crates/vestige-mcp/src/tools/{changelog,cross_reference}.rs
- crates/vestige-mcp/src/dashboard/websocket.rs

Verified: cargo clippy --workspace -- -D warnings green on rustc 1.95.0;
cargo test --workspace unchanged (1292 tests green).
This commit is contained in:
Sam Valladares 2026-04-19 21:11:49 -05:00
parent 4c2016596c
commit 318d4db147
12 changed files with 21 additions and 20 deletions

View file

@ -673,11 +673,11 @@ impl GitAnalyzer {
// Top contributors
let mut top_contributors: Vec<_> = author_counts.into_iter().collect();
top_contributors.sort_by(|a, b| b.1.cmp(&a.1));
top_contributors.sort_by_key(|b| std::cmp::Reverse(b.1));
// Hot files (most frequently changed)
let mut hot_files: Vec<_> = file_counts.into_iter().collect();
hot_files.sort_by(|a, b| b.1.cmp(&a.1));
hot_files.sort_by_key(|b| std::cmp::Reverse(b.1));
Ok(HistoryAnalysis {
bug_fixes,

View file

@ -579,7 +579,7 @@ impl RelationshipTracker {
}
let mut sorted: Vec<_> = file_degrees.into_iter().collect();
sorted.sort_by(|a, b| b.1.cmp(&a.1));
sorted.sort_by_key(|b| std::cmp::Reverse(b.1));
sorted.truncate(limit);
sorted