From a5896e046cfe6e811546122bb28054d92fe10b68 Mon Sep 17 00:00:00 2001 From: Anders Olsson Date: Fri, 5 Jun 2026 15:01:14 +0200 Subject: [PATCH] =?UTF-8?q?refactor:=20address=20review=20=E2=80=94=20sort?= =?UTF-8?q?=5Fby=5Fkey=20and=20optional=20comment=20timestamps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/providers/hitta/src/parser.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/providers/hitta/src/parser.rs b/crates/providers/hitta/src/parser.rs index 545eca8..8047a3c 100644 --- a/crates/providers/hitta/src/parser.rs +++ b/crates/providers/hitta/src/parser.rs @@ -42,7 +42,7 @@ struct Statistics { #[derive(Debug, Deserialize)] struct RawComment { comment: String, - timestamp: u64, + timestamp: Option, } pub fn request_urls(number: &str) -> Vec { @@ -96,13 +96,13 @@ pub fn parse(body: &str) -> Result { .into_iter() .filter(|raw| !raw.comment.trim().is_empty()) .map(|raw| ParsedComment { - timestamp: Some((raw.timestamp / 1000) as i64), + timestamp: raw.timestamp.map(|millis| (millis / 1000) as i64), title: None, message: raw.comment, }) .collect(); - comments.sort_by(|a, b| b.timestamp.cmp(&a.timestamp)); + comments.sort_by_key(|comment| std::cmp::Reverse(comment.timestamp)); return Ok(ParsedEntry { messages: Vec::new(),