Skip to content

fix(evm): use sort_by_key to satisfy clippy unnecessary_sort_by lint#100

Open
panos-xyz wants to merge 1 commit intomainfrom
fix/clippy-sort-by-key
Open

fix(evm): use sort_by_key to satisfy clippy unnecessary_sort_by lint#100
panos-xyz wants to merge 1 commit intomainfrom
fix/clippy-sort-by-key

Conversation

@panos-xyz
Copy link
Copy Markdown
Contributor

@panos-xyz panos-xyz commented Apr 21, 2026

Summary

  • Fix clippy::unnecessary_sort_by lint in crates/evm/src/block/curie.rs:129
  • Change sort_by(|(a, _), (b, _)| a.cmp(b))sort_by_key(|(a, _)| *a)

Background

CI upgraded to Rust 1.95.0 which introduced the unnecessary_sort_by lint as a warning. Local dev still on 1.92.0 so this wasn't caught before merging. Blocking dependabot PR #99.

Summary by CodeRabbit

  • Refactor
    • Simplified internal sorting logic for improved code maintainability.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e2b8746f-23d0-44ed-a882-fa037b4a2e92

📥 Commits

Reviewing files that changed from the base of the PR and between faec4c8 and 72a1d78.

📒 Files selected for processing (1)
  • crates/evm/src/block/curie.rs

📝 Walkthrough

Walkthrough

The sorting logic in a Curie fork test was refactored from using sort_by with a comparator closure to using sort_by_key with a key extraction function, simplifying the code while preserving the intended ordering by storage slot value.

Changes

Cohort / File(s) Summary
Sorting Refactoring
crates/evm/src/block/curie.rs
Changed oracle storage entry sorting from sort_by comparator closure to sort_by_key approach, reducing code verbosity.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A rabbit hops through sorting code,
From sort_by down a simpler road,
With sort_by_key so clean and bright,
The storage slots now sort just right! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: replacing sort_by with sort_by_key to fix a clippy lint, which matches the actual code modification shown in the summary.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/clippy-sort-by-key

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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