From 07e7347e4abde7260b8fcfd886a2509197f06c65 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Fri, 26 Aug 2022 18:57:39 -0700 Subject: *cargo fmt --- src/sync.rs | 16 ++++++++++++---- src/util/fifo_queue.rs | 4 ++-- src/util/lifo_queue.rs | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/sync.rs b/src/sync.rs index 64d3326..00d4d39 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -122,11 +122,19 @@ impl interface::Mutex for SpinLock { fn lock<'a, R>(&'a self, f: impl FnOnce(&'a mut T) -> R) -> R { loop { // Loop until acquired the lock - match self.lock - .compare_exchange(false, true, Ordering::Acquire, Ordering::Acquire) + match self + .lock + .compare_exchange(false, true, Ordering::Acquire, Ordering::Acquire) { - Ok(false) => { break; } - _ => {} + Ok(false) => { + break; + } + Ok(true) => { + break; + } + Err(true) => { + break; + } } } let data = unsafe { &mut *self.data.get() }; diff --git a/src/util/fifo_queue.rs b/src/util/fifo_queue.rs index bb3d8b1..41431a5 100644 --- a/src/util/fifo_queue.rs +++ b/src/util/fifo_queue.rs @@ -3,9 +3,9 @@ //! Provides the FIFO queue structure for allocations use crate::sync::interface::Mutex; #[allow(unused_imports)] -use crate::sync::SpinLock; -#[allow(unused_imports)] use crate::sync::NullLock; +#[allow(unused_imports)] +use crate::sync::SpinLock; use crate::util::node::*; use core::fmt; use core::fmt::{Debug, Formatter}; diff --git a/src/util/lifo_queue.rs b/src/util/lifo_queue.rs index cb0648b..5c626f3 100644 --- a/src/util/lifo_queue.rs +++ b/src/util/lifo_queue.rs @@ -3,9 +3,9 @@ //! Queue structure use crate::sync::interface::Mutex; #[allow(unused_imports)] -use crate::sync::SpinLock; -#[allow(unused_imports)] use crate::sync::NullLock; +#[allow(unused_imports)] +use crate::sync::SpinLock; use crate::util::node::*; use core::fmt; use core::fmt::{Debug, Formatter}; -- cgit v1.2.1