diff options
Diffstat (limited to 'tokio-test/src/task.rs')
-rw-r--r-- | tokio-test/src/task.rs | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/tokio-test/src/task.rs b/tokio-test/src/task.rs index 82d29134..728117cc 100644 --- a/tokio-test/src/task.rs +++ b/tokio-test/src/task.rs @@ -46,21 +46,11 @@ const SLEEP: usize = 2; impl<T> Spawn<T> { /// Consumes `self` returning the inner value - pub fn into_inner(mut self) -> T + pub fn into_inner(self) -> T where T: Unpin, { - drop(self.task); - - // Pin::into_inner is unstable, so we work around it - // - // Safety: `T` is bound by `Unpin`. - unsafe { - let ptr = Pin::get_mut(self.future.as_mut()) as *mut T; - let future = Box::from_raw(ptr); - mem::forget(self.future); - *future - } + *Pin::into_inner(self.future) } /// Returns `true` if the inner future has received a wake notification |