From bcac39a2764e2f3ea665bf8fabc8166580508ba3 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Thu, 29 Dec 2022 03:58:31 +0400 Subject: [PATCH] Fix clippy --- crates/teloxide-core/src/adaptors/throttle/worker.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/teloxide-core/src/adaptors/throttle/worker.rs b/crates/teloxide-core/src/adaptors/throttle/worker.rs index 6a2994dd..4712b22f 100644 --- a/crates/teloxide-core/src/adaptors/throttle/worker.rs +++ b/crates/teloxide-core/src/adaptors/throttle/worker.rs @@ -183,8 +183,8 @@ pub(super) async fn worker( // (waffle) let now = Instant::now(); - let min_back = now - MINUTE; - let sec_back = now - SECOND; + let min_back = now.checked_sub(MINUTE).unwrap_or(now); + let sec_back = now.checked_sub(SECOND).unwrap_or(now); // make history and requests_sent up-to-date while let Some((_, time)) = history.front() {