From 1ec3385b104828ee9548e1bccee82e6c30d259bd Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Thu, 21 May 2026 22:11:42 +0800 Subject: [PATCH] fix timer clippy warnings --- src-tauri/src/core/timer.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/core/timer.rs b/src-tauri/src/core/timer.rs index 6e558b593..173eddd61 100644 --- a/src-tauri/src/core/timer.rs +++ b/src-tauri/src/core/timer.rs @@ -31,7 +31,7 @@ struct TaskState { } impl TaskState { - fn new(key: Key, interval_minutes: u64) -> Self { + const fn new(key: Key, interval_minutes: u64) -> Self { Self { key: Some(key), interval_minutes, @@ -70,7 +70,8 @@ impl Timer { return Ok(()); } - if let Some(command_rx) = self.command_rx.lock().take() { + let command_rx = { self.command_rx.lock().take() }; + if let Some(command_rx) = command_rx { let command_tx = self.command_tx.clone(); AsyncHandler::spawn(move || async move { Self::run_scheduler(command_rx, command_tx).await; @@ -333,7 +334,7 @@ impl Timer { }); } - fn interval_duration(interval_minutes: u64) -> Duration { + const fn interval_duration(interval_minutes: u64) -> Duration { Duration::from_secs(interval_minutes.saturating_mul(60)) }