Skip to content

fix(cache): switch to sort_by_key for LRU ordering#131

Merged
SuperKali merged 1 commit intomainfrom
fix/clippy-unnecessary-sort-by
Apr 18, 2026
Merged

fix(cache): switch to sort_by_key for LRU ordering#131
SuperKali merged 1 commit intomainfrom
fix/clippy-unnecessary-sort-by

Conversation

@SuperKali
Copy link
Copy Markdown
Member

Clippy 1.95 (rust-1.95.0) added the unnecessary_sort_by lint, which triggers on the explicit sort_by closure used for the LRU cache ordering in cache.rs. Since the comparator is a plain Ord on a single SystemTime key, the shorter sort_by_key form is equivalent and lets the compiler skip the extra closure indirection. The previous local toolchain (1.91) didn't ship this lint yet, which is why it only showed up on CI after the last release build.

Clippy 1.95 flags the explicit `sort_by` closure as
unnecessary_sort_by when the comparator is a plain Ord on a single
key. Using sort_by_key is shorter and lets the compiler avoid the
extra closure indirection.
@SuperKali SuperKali merged commit 6cf7512 into main Apr 18, 2026
2 of 4 checks passed
@SuperKali SuperKali deleted the fix/clippy-unnecessary-sort-by branch April 18, 2026 16:45
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.

1 participant