From ddcf2fad5721508c03054651d225d79ce9e3fbca Mon Sep 17 00:00:00 2001 From: zombocoder Date: Wed, 1 Jul 2026 11:36:06 +0300 Subject: [PATCH] fix: replace sort_by with sort_by_key to satisfy clippy unnecessary_sort_by Rust 1.96's clippy flags manual comparator closures that just reverse a key. Use sort_by_key(|x| Reverse(...)) instead. --- src/github/graphql.rs | 2 +- src/ui/widgets.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/github/graphql.rs b/src/github/graphql.rs index 810c778..c27a114 100644 --- a/src/github/graphql.rs +++ b/src/github/graphql.rs @@ -245,7 +245,7 @@ impl GithubClient { } // Sort by updated_at descending - inbox.sort_by(|a, b| b.updated_at.cmp(&a.updated_at)); + inbox.sort_by_key(|item| std::cmp::Reverse(item.updated_at)); debug!(count = inbox.len(), "Fetched inbox"); Ok((inbox, rate_limit)) diff --git a/src/ui/widgets.rs b/src/ui/widgets.rs index 313be2f..f675e67 100644 --- a/src/ui/widgets.rs +++ b/src/ui/widgets.rs @@ -262,7 +262,7 @@ fn render_org_overview( .iter() .filter(|r| !r.is_archived && r.open_pr_count > 0) .collect(); - repos_with_prs.sort_by(|a, b| b.open_pr_count.cmp(&a.open_pr_count)); + repos_with_prs.sort_by_key(|r| std::cmp::Reverse(r.open_pr_count)); if !repos_with_prs.is_empty() { lines.push(Line::from(Span::styled(