@@ -3,7 +3,7 @@ use crate::collections::VecDeque;
33use crate :: ffi:: c_void;
44use crate :: ops:: { Deref , DerefMut , Drop } ;
55use crate :: ptr;
6- use crate :: sync:: atomic:: { AtomicUsize , Ordering , spin_loop_hint } ;
6+ use crate :: sync:: atomic:: { spin_loop_hint , AtomicUsize , Ordering } ;
77use crate :: sys:: hermit:: abi;
88
99/// This type provides a lock based on busy waiting to realize mutual exclusion
@@ -50,10 +50,7 @@ impl<T> Spinlock<T> {
5050 #[ inline]
5151 pub unsafe fn lock ( & self ) -> SpinlockGuard < ' _ , T > {
5252 self . obtain_lock ( ) ;
53- SpinlockGuard {
54- dequeue : & self . dequeue ,
55- data : & mut * self . data . get ( ) ,
56- }
53+ SpinlockGuard { dequeue : & self . dequeue , data : & mut * self . data . get ( ) }
5754 }
5855}
5956
@@ -147,10 +144,7 @@ struct MutexInner {
147144
148145impl MutexInner {
149146 pub const fn new ( ) -> MutexInner {
150- MutexInner {
151- locked : false ,
152- blocked_task : PriorityQueue :: new ( ) ,
153- }
147+ MutexInner { locked : false , blocked_task : PriorityQueue :: new ( ) }
154148 }
155149}
156150
@@ -163,9 +157,7 @@ unsafe impl Sync for Mutex {}
163157
164158impl Mutex {
165159 pub const fn new ( ) -> Mutex {
166- Mutex {
167- inner : Spinlock :: new ( MutexInner :: new ( ) ) ,
168- }
160+ Mutex { inner : Spinlock :: new ( MutexInner :: new ( ) ) }
169161 }
170162
171163 #[ inline]
@@ -211,8 +203,7 @@ impl Mutex {
211203 }
212204
213205 #[ inline]
214- pub unsafe fn destroy ( & self ) {
215- }
206+ pub unsafe fn destroy ( & self ) { }
216207}
217208
218209pub struct ReentrantMutex {
0 commit comments