Skip to content

fix(merger): use sort_by_key to satisfy clippy::unnecessary_sort_by - #12

Open
jenish-25 wants to merge 1 commit into
cakevm:mainfrom
jenish-25:fix/clippy-unnecessary-sort-by
Open

fix(merger): use sort_by_key to satisfy clippy::unnecessary_sort_by#12
jenish-25 wants to merge 1 commit into
cakevm:mainfrom
jenish-25:fix/clippy-unnecessary-sort-by

Conversation

@jenish-25

Copy link
Copy Markdown

Summary

make clippy is currently failing in CI (on main and every PR). Clippy runs on nightly with -D warnings, and the clippy::unnecessary_sort_by lint now errors on the sort_by comparator closures in the merger actors.

This replaces them with the equivalent sort_by_key (using std::cmp::Reverse for the descending cases), which is clippy's own machine-applicable suggestion and preserves ordering behavior.

Changes

  • swappath_merger_actor.rs — 2 sorts (one lib, one test)
  • diffpath_merger_actor.rs — 1 sort
  • samepath_merger_actor.rs — 1 sort

Verification

  • cargo clippy -p kabu-strategy-merger --all-features --all-targets -- -D warnings — clean
  • cargo test -p kabu-strategy-merger --lib — passes (test_sort confirms ordering is unchanged)
  • cargo fmt — clean

Nightly clippy flags the sort_by comparator closures in the merger actors
under -D warnings, breaking make clippy in CI. Replace them with the
equivalent sort_by_key (+ Reverse for the descending cases).
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