mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-12-23 08:21:09 +00:00
clippy
This commit is contained in:
parent
4a13286d62
commit
46a7d20c12
3 changed files with 3 additions and 6 deletions
|
|
@ -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()
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue