From 8c462868b6c50ae2e5e4234a3dae12af83f18e09 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 18 May 2025 07:52:32 +0300 Subject: [PATCH] daemon: use `abs_diff` to remove lossy casts --- src/daemon.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/daemon.rs b/src/daemon.rs index 16b3548..b26acf3 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -522,8 +522,7 @@ pub fn run_daemon(mut config: AppConfig, verbose: bool) -> Result<(), AppError> // or if we haven't computed an interval yet if system_history.last_computed_interval.is_none() || (system_history.last_cpu_volatility - current_cpu_volatility).abs() > 1.0 - || (system_history.last_idle_secs as i64 - current_idle_secs as i64).abs() - > 10 + || u64::abs_diff(system_history.last_idle_secs, current_idle_secs) > 10 { let optimal_interval = system_history.calculate_optimal_interval(&config, on_battery);