Skip to content

Fix Clippy failure in HID device ranking sort - #1

Merged
fldc merged 3 commits into
masterfrom
copilot/fix-clippy-action-failure
Jun 9, 2026
Merged

fldc merged 3 commits into
masterfrom
copilot/fix-clippy-action-failure

Conversation

Copilot AI commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

The Clippy workflow failed under -D warnings due to clippy::unnecessary_sort_by in HID device ranking. This updates the ranking sort to the lint-compliant key-based form without changing ordering semantics.

  • CI failure root cause

    • src/hid_transport.rs used a comparator-based descending sort:
      • ranked.sort_by(|a, b| b.1.cmp(&a.1));
    • Clippy flagged this as unnecessary_sort_by.
  • Code change

    • Replaced comparator sort with key sort using Reverse for descending score order:
      • ranked.sort_by_key(|item| std::cmp::Reverse(item.1));
    • Kept the existing score model and selection flow unchanged.
  • Behavioral impact

    • No functional change intended: device candidates are still ordered by highest score first.
    • Change is scoped to lint compliance for the existing ranking logic.
// Before
ranked.sort_by(|a, b| b.1.cmp(&a.1));

// After
ranked.sort_by_key(|item| std::cmp::Reverse(item.1));

Copilot AI changed the title [WIP] Fix failing GitHub Actions job Clippy Fix Clippy failure in HID device ranking sort Jun 9, 2026
Copilot finished work on behalf of fldc June 9, 2026 14:11
Copilot AI requested a review from fldc June 9, 2026 14:11
@fldc
fldc marked this pull request as ready for review June 9, 2026 14:14
@fldc
fldc merged commit 974ca69 into master Jun 9, 2026
5 checks passed
@fldc
fldc deleted the copilot/fix-clippy-action-failure branch June 9, 2026 14:14
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