Skip to content

Fix clippy unnecessary_sort_by lint on rust 1.95#2

Merged
refined-element merged 3 commits into
mainfrom
fix/clippy-unnecessary-sort-by
Apr 29, 2026
Merged

Fix clippy unnecessary_sort_by lint on rust 1.95#2
refined-element merged 3 commits into
mainfrom
fix/clippy-unnecessary-sort-by

Conversation

@refined-element
Copy link
Copy Markdown
Owner

Summary

  • CI's stable clippy was bumped to 1.95, which made unnecessary_sort_by a default warning. With -D warnings in CI, that breaks the build on main.
  • Replaces records.sort_by(|a, b| b.last_seen.cmp(&a.last_seen)) in wolfe-store/src/peers.rs:138 with the lint's own fix-it: sort_by_key(|r| std::cmp::Reverse(r.last_seen)). Functionally identical (descending sort by last_seen: u64).

Test plan

  • cargo fmt --all -- --check
  • cargo clippy -p wolfe-store --all-targets -- -D warnings
  • Wait for CI Build & Test to go green on this branch

🤖 Generated with Claude Code

CI's stable clippy (now 1.95) added unnecessary_sort_by as a default
warning, which is denied via -D warnings. Replace the closure-based
descending sort with sort_by_key + std::cmp::Reverse, matching the
clippy fix-it suggestion.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 29, 2026 01:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates wolfe-store to satisfy Rust 1.95’s default clippy::unnecessary_sort_by warning while preserving the existing behavior (descending ordering by last_seen) in peer listing.

Changes:

  • Replace a manual comparator (sort_by) with sort_by_key + std::cmp::Reverse to maintain descending sort order and address the Clippy lint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

refined-element and others added 2 commits April 28, 2026 21:55
Replace nested if inside Inventory::Transaction match arm with a guard,
matching clippy 1.95's fix-it for the collapsible_match lint.

Verified locally with `cargo +1.95 clippy --all-targets -- -D warnings -A dead_code`
which now exits clean (only deps/lightning-0.2.2 vendored warnings remain,
and those are warn-level, not deny).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three new advisories landed against rustls-webpki <0.103.12 (RUSTSEC-2026-0098,
RUSTSEC-2026-0099, RUSTSEC-2026-0104). They reach us transitively through
nostr-sdk -> nostr-relay-pool -> async-wsocket -> tokio-rustls -> rustls. The
0.103.x line is semver-compatible, so a Cargo.lock-only bump is enough.

Verified locally with `cargo audit --ignore RUSTSEC-2026-0049 --ignore
RUSTSEC-2024-0384` (matching CI's ignore list): exit 0, no vulnerabilities,
only the pre-existing rand soundness warning remains.

Cargo.lock also picks up the rust-embed deps that were missing from
the lockfile after commit 08309e1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@refined-element refined-element merged commit de1bf7e into main Apr 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants