We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
AsyncCallFuture
1 parent 54907f8 commit 5b38af9Copy full SHA for 5b38af9
1 file changed
src/function.rs
@@ -18,7 +18,7 @@ use {
18
crate::traits::LuaNativeAsyncFn,
19
crate::types::AsyncCallback,
20
std::future::{self, Future},
21
- std::pin::Pin,
+ std::pin::{pin, Pin},
22
std::task::{Context, Poll},
23
};
24
@@ -669,13 +669,9 @@ impl<R: FromLuaMulti> Future for AsyncCallFuture<R> {
669
type Output = Result<R>;
670
671
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
672
- // Safety: We're not moving any pinned data
673
- let this = unsafe { self.get_unchecked_mut() };
+ let this = self.get_mut();
674
match &mut this.0 {
675
- Ok(thread) => {
676
- let pinned_thread = unsafe { Pin::new_unchecked(thread) };
677
- pinned_thread.poll(cx)
678
- }
+ Ok(thread) => pin!(thread).poll(cx),
679
Err(err) => Poll::Ready(Err(err.clone())),
680
}
681
0 commit comments