From 46a7d20c125f235010daa806dcce29bc5efe47bb Mon Sep 17 00:00:00 2001 From: pedrocarlo Date: Thu, 10 Jul 2025 12:48:09 -0300 Subject: [PATCH] clippy --- core/io/clock.rs | 2 -- simulator/runner/clock.rs | 4 ++-- simulator/runner/file.rs | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/io/clock.rs b/core/io/clock.rs index 8c12aa4e5..aae1a7633 100644 --- a/core/io/clock.rs +++ b/core/io/clock.rs @@ -13,8 +13,6 @@ impl From> for Instant { } } - - pub trait Clock { fn now(&self) -> Instant; } diff --git a/simulator/runner/clock.rs b/simulator/runner/clock.rs index 56ef72f1f..2f89e93e6 100644 --- a/simulator/runner/clock.rs +++ b/simulator/runner/clock.rs @@ -12,7 +12,7 @@ pub struct SimulatorClock { impl SimulatorClock { const MIN_TICK: u64 = 1; - const MAX_TICK: u64 = 50; + const MAX_TICK: u64 = 30; pub fn new(rng: ChaCha8Rng) -> Self { Self { @@ -28,7 +28,7 @@ impl SimulatorClock { .borrow_mut() .gen_range(Self::MIN_TICK..Self::MAX_TICK); let nanos = std::time::Duration::from_micros(nanos); - *time = *time + nanos; + *time += nanos; *time } } diff --git a/simulator/runner/file.rs b/simulator/runner/file.rs index 6bebbc5e1..6df14c89d 100644 --- a/simulator/runner/file.rs +++ b/simulator/runner/file.rs @@ -4,7 +4,6 @@ use std::{ sync::Arc, }; -use chrono::{DateTime, Utc}; use rand::Rng as _; use rand_chacha::ChaCha8Rng; use tracing::{instrument, Level}; @@ -102,7 +101,7 @@ impl SimulatorFile { // Chance to introduce some latency rng.gen_bool(self.latency_probability as f64 / 100.0) .then(|| { - let now: DateTime = self.clock.now().into(); + let now = self.clock.now(); let sum = now + std::time::Duration::from_millis(rng.gen_range(5..20)); sum.into() })