From 0020242571ff9208d647788934faa28b64c6a1d7 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 6 Jan 2023 23:40:05 +0900 Subject: [PATCH] Format --- plume-models/src/posts.rs | 6 +++++- plume-models/src/search/query.rs | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index b78690d9..203e0d5e 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -756,7 +756,11 @@ impl FromId for Post { let timestamp_secs = published.unix_timestamp(); let timestamp_nanos = published.unix_timestamp_nanos() - (timestamp_secs as i128) * 1000i128 * 1000i128 * 1000i128; - NaiveDateTime::from_timestamp_opt(timestamp_secs, timestamp_nanos as u32).unwrap() + NaiveDateTime::from_timestamp_opt( + timestamp_secs, + timestamp_nanos as u32, + ) + .unwrap() }), subtitle: article .summary() diff --git a/plume-models/src/search/query.rs b/plume-models/src/search/query.rs index edab5711..5dcd605c 100644 --- a/plume-models/src/search/query.rs +++ b/plume-models/src/search/query.rs @@ -180,9 +180,13 @@ impl PlumeQuery { if self.before.is_some() || self.after.is_some() { // if at least one range bound is provided - let after = self - .after - .unwrap_or_else(|| i64::from(NaiveDate::from_ymd_opt(2000, 1, 1).unwrap().num_days_from_ce())); + let after = self.after.unwrap_or_else(|| { + i64::from( + NaiveDate::from_ymd_opt(2000, 1, 1) + .unwrap() + .num_days_from_ce(), + ) + }); let before = self .before .unwrap_or_else(|| i64::from(Utc::now().date_naive().num_days_from_ce())); @@ -209,9 +213,13 @@ impl PlumeQuery { // documents older than the provided date will be ignored pub fn after(&mut self, date: &D) -> &mut Self { - let after = self - .after - .unwrap_or_else(|| i64::from(NaiveDate::from_ymd_opt(2000, 1, 1).unwrap().num_days_from_ce())); + let after = self.after.unwrap_or_else(|| { + i64::from( + NaiveDate::from_ymd_opt(2000, 1, 1) + .unwrap() + .num_days_from_ce(), + ) + }); self.after = Some(cmp::max(after, i64::from(date.num_days_from_ce()))); self }