Skip to content

Commit

Permalink
Fix From<LocalWaker>
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorBreakfast committed Jul 29, 2018
1 parent fb0653e commit ea25cf1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/libcore/task/wake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Waker {
/// `Arc` type and the safe `Wake` trait.
#[inline]
pub unsafe fn new(inner: NonNull<dyn UnsafeWake>) -> Self {
Waker { inner: inner }
Waker { inner }
}

/// Wake up the task associated with this `Waker`.
Expand Down Expand Up @@ -120,7 +120,7 @@ impl LocalWaker {
/// on the current thread.
#[inline]
pub unsafe fn new(inner: NonNull<dyn UnsafeWake>) -> Self {
LocalWaker { inner: inner }
LocalWaker { inner }
}

/// Wake up the task associated with this `LocalWaker`.
Expand Down Expand Up @@ -159,7 +159,9 @@ impl LocalWaker {
impl From<LocalWaker> for Waker {
#[inline]
fn from(local_waker: LocalWaker) -> Self {
Waker { inner: local_waker.inner }
let inner = local_waker.inner;
mem::forget(local_waker);
Waker { inner }
}
}

Expand Down

0 comments on commit ea25cf1

Please sign in to comment.