mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-02 06:44:23 +01:00
clippy
This commit is contained in:
@@ -13,8 +13,6 @@ impl<T: chrono::TimeZone> From<chrono::DateTime<T>> for Instant {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
pub trait Clock {
|
||||
fn now(&self) -> Instant;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Utc> = self.clock.now().into();
|
||||
let now = self.clock.now();
|
||||
let sum = now + std::time::Duration::from_millis(rng.gen_range(5..20));
|
||||
sum.into()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user