Fix clippy unnecessary_sort_by lint on rust 1.95#2
Merged
Conversation
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>
There was a problem hiding this comment.
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) withsort_by_key+std::cmp::Reverseto maintain descending sort order and address the Clippy lint.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
unnecessary_sort_bya default warning. With-D warningsin CI, that breaks the build onmain.records.sort_by(|a, b| b.last_seen.cmp(&a.last_seen))inwolfe-store/src/peers.rs:138with the lint's own fix-it:sort_by_key(|r| std::cmp::Reverse(r.last_seen)). Functionally identical (descending sort bylast_seen: u64).Test plan
cargo fmt --all -- --checkcargo clippy -p wolfe-store --all-targets -- -D warnings🤖 Generated with Claude Code