@@ -42,8 +42,8 @@ unsafe fn remove_drop_lifetime<'a, T>(ptr: unsafe fn (*mut (dyn Future<Output =
42
42
impl < ' a , T > LocalFutureObj < ' a , T > {
43
43
/// Create a `LocalFutureObj` from a custom trait object representation.
44
44
#[ inline]
45
- pub fn new < F : UnsafeFutureObj < ' a , T > + ' a > ( f : F ) -> LocalFutureObj < ' a , T > {
46
- LocalFutureObj {
45
+ pub fn new < F : UnsafeFutureObj < ' a , T > + ' a > ( f : F ) -> Self {
46
+ Self {
47
47
future : unsafe { remove_future_lifetime ( f. into_raw ( ) ) } ,
48
48
drop_fn : unsafe { remove_drop_lifetime ( F :: drop) } ,
49
49
_marker : PhantomData ,
@@ -72,7 +72,7 @@ impl<T> fmt::Debug for LocalFutureObj<'_, T> {
72
72
73
73
impl < ' a , T > From < FutureObj < ' a , T > > for LocalFutureObj < ' a , T > {
74
74
#[ inline]
75
- fn from ( f : FutureObj < ' a , T > ) -> LocalFutureObj < ' a , T > {
75
+ fn from ( f : FutureObj < ' a , T > ) -> Self {
76
76
f. 0
77
77
}
78
78
}
@@ -113,8 +113,8 @@ unsafe impl<T> Send for FutureObj<'_, T> {}
113
113
impl < ' a , T > FutureObj < ' a , T > {
114
114
/// Create a `FutureObj` from a custom trait object representation.
115
115
#[ inline]
116
- pub fn new < F : UnsafeFutureObj < ' a , T > + Send > ( f : F ) -> FutureObj < ' a , T > {
117
- FutureObj ( LocalFutureObj :: new ( f) )
116
+ pub fn new < F : UnsafeFutureObj < ' a , T > + Send > ( f : F ) -> Self {
117
+ Self ( LocalFutureObj :: new ( f) )
118
118
}
119
119
}
120
120
@@ -296,49 +296,49 @@ mod if_alloc {
296
296
297
297
impl < ' a , F : Future < Output = ( ) > + Send + ' a > From < Box < F > > for FutureObj < ' a , ( ) > {
298
298
fn from ( boxed : Box < F > ) -> Self {
299
- FutureObj :: new ( boxed)
299
+ Self :: new ( boxed)
300
300
}
301
301
}
302
302
303
303
impl < ' a > From < Box < dyn Future < Output = ( ) > + Send + ' a > > for FutureObj < ' a , ( ) > {
304
304
fn from ( boxed : Box < dyn Future < Output = ( ) > + Send + ' a > ) -> Self {
305
- FutureObj :: new ( boxed)
305
+ Self :: new ( boxed)
306
306
}
307
307
}
308
308
309
309
impl < ' a , F : Future < Output = ( ) > + Send + ' a > From < Pin < Box < F > > > for FutureObj < ' a , ( ) > {
310
310
fn from ( boxed : Pin < Box < F > > ) -> Self {
311
- FutureObj :: new ( boxed)
311
+ Self :: new ( boxed)
312
312
}
313
313
}
314
314
315
315
impl < ' a > From < Pin < Box < dyn Future < Output = ( ) > + Send + ' a > > > for FutureObj < ' a , ( ) > {
316
316
fn from ( boxed : Pin < Box < dyn Future < Output = ( ) > + Send + ' a > > ) -> Self {
317
- FutureObj :: new ( boxed)
317
+ Self :: new ( boxed)
318
318
}
319
319
}
320
320
321
321
impl < ' a , F : Future < Output = ( ) > + ' a > From < Box < F > > for LocalFutureObj < ' a , ( ) > {
322
322
fn from ( boxed : Box < F > ) -> Self {
323
- LocalFutureObj :: new ( boxed)
323
+ Self :: new ( boxed)
324
324
}
325
325
}
326
326
327
327
impl < ' a > From < Box < dyn Future < Output = ( ) > + ' a > > for LocalFutureObj < ' a , ( ) > {
328
328
fn from ( boxed : Box < dyn Future < Output = ( ) > + ' a > ) -> Self {
329
- LocalFutureObj :: new ( boxed)
329
+ Self :: new ( boxed)
330
330
}
331
331
}
332
332
333
333
impl < ' a , F : Future < Output = ( ) > + ' a > From < Pin < Box < F > > > for LocalFutureObj < ' a , ( ) > {
334
334
fn from ( boxed : Pin < Box < F > > ) -> Self {
335
- LocalFutureObj :: new ( boxed)
335
+ Self :: new ( boxed)
336
336
}
337
337
}
338
338
339
339
impl < ' a > From < Pin < Box < dyn Future < Output = ( ) > + ' a > > > for LocalFutureObj < ' a , ( ) > {
340
340
fn from ( boxed : Pin < Box < dyn Future < Output = ( ) > + ' a > > ) -> Self {
341
- LocalFutureObj :: new ( boxed)
341
+ Self :: new ( boxed)
342
342
}
343
343
}
344
344
}
0 commit comments