From 30378f7b6ad838402b32df709b70a92cacb2ef6f Mon Sep 17 00:00:00 2001 From: infosave2007 Date: Wed, 8 Jul 2026 20:09:54 +0300 Subject: [PATCH] chore: fix clippy lints to green the lint CI - import.rs / promotion.rs: sort_by(|a,b| b.k.cmp(&a.k)) -> sort_by_key(Reverse(k)) - pipeline.rs: skip_while(!p).next() -> find(p) Behaviour-preserving; completes the CI fix started by the cargo fmt commit. --- src/import.rs | 2 +- src/pipeline.rs | 2 +- src/promotion.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/import.rs b/src/import.rs index 4021ba7..767e851 100644 --- a/src/import.rs +++ b/src/import.rs @@ -184,7 +184,7 @@ impl JobStore { } pub fn list(&self) -> Vec { let mut v: Vec = self.jobs.lock().unwrap().values().cloned().collect(); - v.sort_by(|a, b| b.started.cmp(&a.started)); + v.sort_by_key(|x| std::cmp::Reverse(x.started)); v.truncate(20); v } diff --git a/src/pipeline.rs b/src/pipeline.rs index 88673e7..8c9a4b2 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -730,7 +730,7 @@ fn parse_judge(text: &str) -> (u8, bool) { let score = text .split("score") .nth(1) - .and_then(|t| t.chars().skip_while(|c| !c.is_ascii_digit()).next()) + .and_then(|t| t.chars().find(|c| c.is_ascii_digit())) .and_then(|c| c.to_digit(10)) .map(|d| d.min(4) as u8); let hard_fail = text diff --git a/src/promotion.rs b/src/promotion.rs index 4132e3a..c7d7840 100644 --- a/src/promotion.rs +++ b/src/promotion.rs @@ -272,7 +272,7 @@ impl Promotion { ) }) .collect(); - out.sort_by(|a, b| b.2.cmp(&a.2)); + out.sort_by_key(|x| std::cmp::Reverse(x.2)); out }