mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 13:40:15 +03:00
Rollup merge of #74316 - yoshuawuyts:no-wake-type-hints, r=Mark-Simulacrum
Remove unnecessary type hints from Wake internals While working on https://github.com/rust-lang/rust/pull/74304 I noticed we were writing out the type signature twice in some internal `Wake` impl methods; this streamlines that. Thanks!
This commit is contained in:
@@ -69,14 +69,13 @@ unsafe fn clone_waker<W: Wake + Send + Sync + 'static>(waker: *const ()) -> RawW
|
||||
|
||||
// Wake by value, moving the Arc into the Wake::wake function
|
||||
unsafe fn wake<W: Wake + Send + Sync + 'static>(waker: *const ()) {
|
||||
let waker: Arc<W> = unsafe { Arc::from_raw(waker as *const W) };
|
||||
let waker = unsafe { Arc::from_raw(waker as *const W) };
|
||||
<W as Wake>::wake(waker);
|
||||
}
|
||||
|
||||
// Wake by reference, wrap the waker in ManuallyDrop to avoid dropping it
|
||||
unsafe fn wake_by_ref<W: Wake + Send + Sync + 'static>(waker: *const ()) {
|
||||
let waker: ManuallyDrop<Arc<W>> =
|
||||
unsafe { ManuallyDrop::new(Arc::from_raw(waker as *const W)) };
|
||||
let waker = unsafe { ManuallyDrop::new(Arc::from_raw(waker as *const W)) };
|
||||
<W as Wake>::wake_by_ref(&waker);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user