chore(brand): fix clippy 1.95 unnecessary_sort_by errors

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 <noreply@anthropic.com>
This commit is contained in:
Valerio 2026-04-16 18:32:27 +02:00
parent 9645239fe8
commit 63e94af2e7

View file

@ -427,7 +427,7 @@ fn extract_colors(decls: &[CssDecl]) -> Vec<BrandColor> {
.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<String> {
}
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()
}