From ab8ec84c1bdd5f2c1567d254520e229a33c0384f Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Fri, 8 Mar 2024 15:10:40 +0100 Subject: [PATCH] clippy --- src/fetch/object_id.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fetch/object_id.rs b/src/fetch/object_id.rs index 782900d..f3fa560 100644 --- a/src/fetch/object_id.rs +++ b/src/fetch/object_id.rs @@ -197,9 +197,9 @@ static ACTOR_REFETCH_INTERVAL_SECONDS_DEBUG: i64 = 20; fn should_refetch_object(last_refreshed: DateTime) -> bool { let update_interval = if cfg!(debug_assertions) { // avoid infinite loop when fetching community outbox - ChronoDuration::seconds(ACTOR_REFETCH_INTERVAL_SECONDS_DEBUG) + ChronoDuration::try_seconds(ACTOR_REFETCH_INTERVAL_SECONDS_DEBUG).expect("valid duration") } else { - ChronoDuration::seconds(ACTOR_REFETCH_INTERVAL_SECONDS) + ChronoDuration::try_seconds(ACTOR_REFETCH_INTERVAL_SECONDS).expect("valid duration") }; let refresh_limit = Utc::now() - update_interval; last_refreshed.lt(&refresh_limit) @@ -362,10 +362,10 @@ pub mod tests { #[test] fn test_should_refetch_object() { - let one_second_ago = Utc::now() - ChronoDuration::seconds(1); + let one_second_ago = Utc::now() - ChronoDuration::try_seconds(1).unwrap(); assert!(!should_refetch_object(one_second_ago)); - let two_days_ago = Utc::now() - ChronoDuration::days(2); + let two_days_ago = Utc::now() - ChronoDuration::try_days(2).unwrap(); assert!(should_refetch_object(two_days_ago)); } }