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 }