Skip to content

Commit

Permalink
Since LocalFutureObj implements Unpin, this code can be simplified.
Browse files Browse the repository at this point in the history
  • Loading branch information
najamelan authored and seanmonstar committed Oct 31, 2019
1 parent 6baadce commit 5f6c014
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions futures-core/src/future/future_obj.rs
Expand Up @@ -127,11 +127,8 @@ impl<T> Future for FutureObj<'_, T> {
type Output = T;

#[inline]
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<T> {
let pinned_field: Pin<&mut LocalFutureObj<'_, T>> = unsafe {
self.map_unchecked_mut(|x| &mut x.0)
};
LocalFutureObj::poll(pinned_field, cx)
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<T> {
Pin::new( &mut self.0 ).poll(cx)
}
}

Expand Down

0 comments on commit 5f6c014

Please sign in to comment.