diff --git a/src/libcore/task/wake.rs b/src/libcore/task/wake.rs index 0759ff93ea85f..277df332b4ad5 100644 --- a/src/libcore/task/wake.rs +++ b/src/libcore/task/wake.rs @@ -39,8 +39,8 @@ impl RawWaker { /// function in the `vtable` of the underlying `RawWaker` will be called. #[rustc_promotable] #[stable(feature = "futures_api", since = "1.36.0")] - pub const fn new(data: *const (), vtable: &'static RawWakerVTable) -> RawWaker { - RawWaker { data, vtable } + pub const fn new(data: *const (), vtable: &'static RawWakerVTable) -> Self { + Self { data, vtable } } } @@ -180,7 +180,7 @@ impl<'a> Context<'a> { #[stable(feature = "futures_api", since = "1.36.0")] #[inline] pub fn from_waker(waker: &'a Waker) -> Self { - Context { waker, _marker: PhantomData } + Self { waker, _marker: PhantomData } } /// Returns a reference to the `Waker` for the current task. @@ -277,8 +277,8 @@ impl Waker { /// [`RawWakerVTable`]: struct.RawWakerVTable.html #[inline] #[stable(feature = "futures_api", since = "1.36.0")] - pub unsafe fn from_raw(waker: RawWaker) -> Waker { - Waker { waker } + pub unsafe fn from_raw(waker: RawWaker) -> Self { + Self { waker } } } @@ -286,7 +286,7 @@ impl Waker { impl Clone for Waker { #[inline] fn clone(&self) -> Self { - Waker { + Self { // SAFETY: This is safe because `Waker::from_raw` is the only way // to initialize `clone` and `data` requiring the user to acknowledge // that the contract of [`RawWaker`] is upheld.