Skip to content

Commit 01aee68

Browse files
committed
Reduce unsafe scope
1 parent 9999c6d commit 01aee68

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

futures-util/src/compat/compat01to03.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ impl<Fut: Future01> Future03 for Compat<Fut, ()> {
1515
fn poll(self: PinMut<Self>, cx: &mut task03::Context) -> task03::Poll<Self::Output> {
1616
let notify = &WakerToHandle(cx.waker());
1717

18-
executor01::with_notify(notify, 0, move || unsafe {
19-
match PinMut::get_mut_unchecked(self).inner.poll() {
18+
executor01::with_notify(notify, 0, move || {
19+
match unsafe { PinMut::get_mut_unchecked(self) }.inner.poll() {
2020
Ok(Async01::Ready(t)) => task03::Poll::Ready(Ok(t)),
2121
Ok(Async01::NotReady) => task03::Poll::Pending,
2222
Err(e) => task03::Poll::Ready(Err(e)),
@@ -31,8 +31,8 @@ impl<St: Stream01> Stream03 for Compat<St, ()> {
3131
fn poll_next(self: PinMut<Self>, cx: &mut task03::Context) -> task03::Poll<Option<Self::Item>> {
3232
let notify = &WakerToHandle(cx.waker());
3333

34-
executor01::with_notify(notify, 0, move || unsafe {
35-
match PinMut::get_mut_unchecked(self).inner.poll() {
34+
executor01::with_notify(notify, 0, move || {
35+
match unsafe { PinMut::get_mut_unchecked(self) }.inner.poll() {
3636
Ok(Async01::Ready(Some(t))) => task03::Poll::Ready(Some(Ok(t))),
3737
Ok(Async01::Ready(None)) => task03::Poll::Ready(None),
3838
Ok(Async01::NotReady) => task03::Poll::Pending,

0 commit comments

Comments
 (0)