From 63e94af2e7310be9ab17dd0b5dcb3065be4f417e Mon Sep 17 00:00:00 2001 From: Valerio Date: Thu, 16 Apr 2026 18:32:27 +0200 Subject: [PATCH] chore(brand): fix clippy 1.95 unnecessary_sort_by errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pre-existing sort_by calls in brand.rs became hard errors under clippy 1.95. Switch to sort_by_key with std::cmp::Reverse. Pure refactor — same ordering, no behavior change. Bundled here so CI goes green on the P0 command-injection fix. Co-Authored-By: Claude Opus 4.6 --- crates/webclaw-core/src/brand.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/webclaw-core/src/brand.rs b/crates/webclaw-core/src/brand.rs index 6b874e7..52eb1b7 100644 --- a/crates/webclaw-core/src/brand.rs +++ b/crates/webclaw-core/src/brand.rs @@ -427,7 +427,7 @@ fn extract_colors(decls: &[CssDecl]) -> Vec { .collect(); // Sort by frequency (descending) - colors.sort_by(|a, b| b.count.cmp(&a.count)); + colors.sort_by_key(|c| std::cmp::Reverse(c.count)); // Promote top non-white/black to Primary/Secondary if they're still Unknown let mut assigned_primary = colors.iter().any(|c| c.usage == ColorUsage::Primary); @@ -615,7 +615,7 @@ fn extract_fonts(decls: &[CssDecl]) -> Vec { } let mut fonts: Vec<(String, usize)> = freq.into_iter().collect(); - fonts.sort_by(|a, b| b.1.cmp(&a.1)); + fonts.sort_by_key(|f| std::cmp::Reverse(f.1)); fonts.into_iter().map(|(name, _)| name).collect() }