From 78f11a2f83e0c989f3de750697a89a856e9782ae Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 26 Apr 2023 11:32:06 +0200 Subject: [PATCH] fmt --- src/tools/miri/src/concurrency/thread.rs | 5 ++-- .../miri/src/concurrency/vector_clock.rs | 28 +++++++++---------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/tools/miri/src/concurrency/thread.rs b/src/tools/miri/src/concurrency/thread.rs index a8e4a5fa3dd3..e9bbae4d5048 100644 --- a/src/tools/miri/src/concurrency/thread.rs +++ b/src/tools/miri/src/concurrency/thread.rs @@ -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)), } } } diff --git a/src/tools/miri/src/concurrency/vector_clock.rs b/src/tools/miri/src/concurrency/vector_clock.rs index b36c6be5a720..a6e67ef8699d 100644 --- a/src/tools/miri/src/concurrency/vector_clock.rs +++ b/src/tools/miri/src/concurrency/vector_clock.rs @@ -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, + }, } }