This commit is contained in:
Ralf Jung 2023-04-26 11:32:06 +02:00
parent bd5c1d41f7
commit 78f11a2f83
2 changed files with 16 additions and 17 deletions

View file

@ -272,9 +272,8 @@ impl Time {
fn get_wait_time(&self, clock: &Clock) -> Duration {
match self {
Time::Monotonic(instant) => instant.duration_since(clock.now()),
Time::RealTime(time) => {
time.duration_since(SystemTime::now()).unwrap_or(Duration::new(0, 0))
}
Time::RealTime(time) =>
time.duration_since(SystemTime::now()).unwrap_or(Duration::new(0, 0)),
}
}
}

View file

@ -212,16 +212,14 @@ impl PartialOrd for VClock {
for (l, r) in iter {
match order {
Ordering::Equal => order = l.cmp(r),
Ordering::Less => {
Ordering::Less =>
if l > r {
return None;
}
}
Ordering::Greater => {
},
Ordering::Greater =>
if l < r {
return None;
}
}
},
}
}
@ -236,16 +234,18 @@ impl PartialOrd for VClock {
Ordering::Equal => Some(order),
// Right has at least 1 element > than the implicit 0,
// so the only valid values are Ordering::Less or None.
Ordering::Less => match order {
Ordering::Less | Ordering::Equal => Some(Ordering::Less),
Ordering::Greater => None,
},
Ordering::Less =>
match order {
Ordering::Less | Ordering::Equal => Some(Ordering::Less),
Ordering::Greater => None,
},
// Left has at least 1 element > than the implicit 0,
// so the only valid values are Ordering::Greater or None.
Ordering::Greater => match order {
Ordering::Greater | Ordering::Equal => Some(Ordering::Greater),
Ordering::Less => None,
},
Ordering::Greater =>
match order {
Ordering::Greater | Ordering::Equal => Some(Ordering::Greater),
Ordering::Less => None,
},
}
}