@@ -3,7 +3,7 @@ use crate::collections::VecDeque;
3
3
use crate :: ffi:: c_void;
4
4
use crate :: ops:: { Deref , DerefMut , Drop } ;
5
5
use crate :: ptr;
6
- use crate :: sync:: atomic:: { AtomicUsize , Ordering , spin_loop_hint } ;
6
+ use crate :: sync:: atomic:: { spin_loop_hint , AtomicUsize , Ordering } ;
7
7
use crate :: sys:: hermit:: abi;
8
8
9
9
/// This type provides a lock based on busy waiting to realize mutual exclusion
@@ -50,10 +50,7 @@ impl<T> Spinlock<T> {
50
50
#[ inline]
51
51
pub unsafe fn lock ( & self ) -> SpinlockGuard < ' _ , T > {
52
52
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 ( ) }
57
54
}
58
55
}
59
56
@@ -147,10 +144,7 @@ struct MutexInner {
147
144
148
145
impl MutexInner {
149
146
pub const fn new ( ) -> MutexInner {
150
- MutexInner {
151
- locked : false ,
152
- blocked_task : PriorityQueue :: new ( ) ,
153
- }
147
+ MutexInner { locked : false , blocked_task : PriorityQueue :: new ( ) }
154
148
}
155
149
}
156
150
@@ -163,9 +157,7 @@ unsafe impl Sync for Mutex {}
163
157
164
158
impl Mutex {
165
159
pub const fn new ( ) -> Mutex {
166
- Mutex {
167
- inner : Spinlock :: new ( MutexInner :: new ( ) ) ,
168
- }
160
+ Mutex { inner : Spinlock :: new ( MutexInner :: new ( ) ) }
169
161
}
170
162
171
163
#[ inline]
@@ -211,8 +203,7 @@ impl Mutex {
211
203
}
212
204
213
205
#[ inline]
214
- pub unsafe fn destroy ( & self ) {
215
- }
206
+ pub unsafe fn destroy ( & self ) { }
216
207
}
217
208
218
209
pub struct ReentrantMutex {
0 commit comments