@@ -47,8 +47,8 @@ pub struct OnceNonZeroUsize {
47
47
impl OnceNonZeroUsize {
48
48
/// Creates a new empty cell.
49
49
#[ inline]
50
- pub const fn new ( ) -> OnceNonZeroUsize {
51
- OnceNonZeroUsize { inner : AtomicUsize :: new ( 0 ) }
50
+ pub const fn new ( ) -> Self {
51
+ Self { inner : AtomicUsize :: new ( 0 ) }
52
52
}
53
53
54
54
/// Gets the underlying value.
@@ -169,14 +169,14 @@ pub struct OnceBool {
169
169
impl OnceBool {
170
170
/// Creates a new empty cell.
171
171
#[ inline]
172
- pub const fn new ( ) -> OnceBool {
173
- OnceBool { inner : OnceNonZeroUsize :: new ( ) }
172
+ pub const fn new ( ) -> Self {
173
+ Self { inner : OnceNonZeroUsize :: new ( ) }
174
174
}
175
175
176
176
/// Gets the underlying value.
177
177
#[ inline]
178
178
pub fn get ( & self ) -> Option < bool > {
179
- self . inner . get ( ) . map ( OnceBool :: from_usize)
179
+ self . inner . get ( ) . map ( Self :: from_usize)
180
180
}
181
181
182
182
/// Sets the contents of this cell to `value`.
@@ -185,7 +185,7 @@ impl OnceBool {
185
185
/// full.
186
186
#[ inline]
187
187
pub fn set ( & self , value : bool ) -> Result < ( ) , ( ) > {
188
- self . inner . set ( OnceBool :: to_usize ( value) )
188
+ self . inner . set ( Self :: to_usize ( value) )
189
189
}
190
190
191
191
/// Gets the contents of the cell, initializing it with `f` if the cell was
@@ -198,7 +198,7 @@ impl OnceBool {
198
198
where
199
199
F : FnOnce ( ) -> bool ,
200
200
{
201
- OnceBool :: from_usize ( self . inner . get_or_init ( || OnceBool :: to_usize ( f ( ) ) ) )
201
+ Self :: from_usize ( self . inner . get_or_init ( || Self :: to_usize ( f ( ) ) ) )
202
202
}
203
203
204
204
/// Gets the contents of the cell, initializing it with `f` if
@@ -212,7 +212,7 @@ impl OnceBool {
212
212
where
213
213
F : FnOnce ( ) -> Result < bool , E > ,
214
214
{
215
- self . inner . get_or_try_init ( || f ( ) . map ( OnceBool :: to_usize) ) . map ( OnceBool :: from_usize)
215
+ self . inner . get_or_try_init ( || f ( ) . map ( Self :: to_usize) ) . map ( Self :: from_usize)
216
216
}
217
217
218
218
#[ inline]
@@ -249,8 +249,8 @@ impl<'a, T> Default for OnceRef<'a, T> {
249
249
250
250
impl < ' a , T > OnceRef < ' a , T > {
251
251
/// Creates a new empty cell.
252
- pub const fn new ( ) -> OnceRef < ' a , T > {
253
- OnceRef { inner : AtomicPtr :: new ( ptr:: null_mut ( ) ) , ghost : PhantomData }
252
+ pub const fn new ( ) -> Self {
253
+ Self { inner : AtomicPtr :: new ( ptr:: null_mut ( ) ) , ghost : PhantomData }
254
254
}
255
255
256
256
/// Gets a reference to the underlying value.
@@ -377,13 +377,13 @@ mod once_box {
377
377
378
378
impl < T > OnceBox < T > {
379
379
/// Creates a new empty cell.
380
- pub const fn new ( ) -> OnceBox < T > {
381
- OnceBox { inner : AtomicPtr :: new ( ptr:: null_mut ( ) ) , ghost : PhantomData }
380
+ pub const fn new ( ) -> Self {
381
+ Self { inner : AtomicPtr :: new ( ptr:: null_mut ( ) ) , ghost : PhantomData }
382
382
}
383
383
384
384
/// Creates a new cell with the given value.
385
385
pub fn with_value ( value : Box < T > ) -> Self {
386
- OnceBox { inner : AtomicPtr :: new ( Box :: into_raw ( value) ) , ghost : PhantomData }
386
+ Self { inner : AtomicPtr :: new ( Box :: into_raw ( value) ) , ghost : PhantomData }
387
387
}
388
388
389
389
/// Gets a reference to the underlying value.
0 commit comments