Skip to content

Commit 211edb2

Browse files
joshwilhelmiclaude
andcommitted
[gobby-cli-#122] fix(gsqz): Use sort_by_key for clippy 1.95 unnecessary_sort_by
Two pre-existing call sites in crates/gsqz/src/primitives/group.rs trigger Rust 1.95.0's new clippy::unnecessary_sort_by lint. Local toolchain is 1.94 so they slipped through; CI runs 1.95 and rejects them. Mechanical replacement of sort_by(|a, b| b.1.len().cmp(&a.1.len())) with sort_by_key(|b| std::cmp::Reverse(b.1.len())) at lines 373 and 414. No behavior change. Rolls into the unreleased gsqz 0.4.1 -- no version bump, no CHANGELOG entry (this is a CI correctness fix, not a user-facing change). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 32a3d36 commit 211edb2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

crates/gsqz/src/primitives/group.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ fn group_by_extension(lines: Vec<String>) -> Vec<String> {
370370

371371
// Sort by count descending
372372
let mut sorted: Vec<_> = groups.into_iter().collect();
373-
sorted.sort_by(|a, b| b.1.len().cmp(&a.1.len()));
373+
sorted.sort_by_key(|b| std::cmp::Reverse(b.1.len()));
374374

375375
let mut result = Vec::new();
376376
for (ext, files) in &sorted {
@@ -411,7 +411,7 @@ fn group_by_directory(lines: Vec<String>) -> Vec<String> {
411411
}
412412

413413
let mut sorted: Vec<_> = groups.into_iter().collect();
414-
sorted.sort_by(|a, b| b.1.len().cmp(&a.1.len()));
414+
sorted.sort_by_key(|b| std::cmp::Reverse(b.1.len()));
415415

416416
let mut result = Vec::new();
417417
for (dirname, files) in &sorted {

0 commit comments

Comments
 (0)