diff --git a/crates/subspace-farmer/src/farmer_cache.rs b/crates/subspace-farmer/src/farmer_cache.rs index 86409eceeb..d909f1eb41 100644 --- a/crates/subspace-farmer/src/farmer_cache.rs +++ b/crates/subspace-farmer/src/farmer_cache.rs @@ -1304,13 +1304,11 @@ where // Drive above future and stream back any pieces that were downloaded so far stream::poll_fn(move |cx| { - let end_result = fut.poll_unpin(cx); - - if let Ok(maybe_result) = rx.try_next() { + if let Poll::Ready(maybe_result) = rx.poll_next_unpin(cx) { return Poll::Ready(maybe_result); } - end_result.map(|((), ())| None) + fut.poll_unpin(cx).map(|((), ())| None) }) } diff --git a/crates/subspace-farmer/src/farmer_piece_getter.rs b/crates/subspace-farmer/src/farmer_piece_getter.rs index 14b5fc49ac..1c36064fb9 100644 --- a/crates/subspace-farmer/src/farmer_piece_getter.rs +++ b/crates/subspace-farmer/src/farmer_piece_getter.rs @@ -393,13 +393,11 @@ where // Drive above future and stream back any pieces that were downloaded so far Ok(Box::new(stream::poll_fn(move |cx| { - let end_result = fut.poll_unpin(cx); - - if let Ok(maybe_result) = rx.try_next() { + if let Poll::Ready(maybe_result) = rx.poll_next_unpin(cx) { return Poll::Ready(maybe_result); } - end_result.map(|()| None) + fut.poll_unpin(cx).map(|()| None) }))) } } diff --git a/crates/subspace-networking/src/utils/piece_provider.rs b/crates/subspace-networking/src/utils/piece_provider.rs index e0cf6d2166..2d48621967 100644 --- a/crates/subspace-networking/src/utils/piece_provider.rs +++ b/crates/subspace-networking/src/utils/piece_provider.rs @@ -98,13 +98,11 @@ where // Drive above future and stream back any pieces that were downloaded so far stream::poll_fn(move |cx| { - let end_result = fut.poll_unpin(cx); - - if let Ok(maybe_result) = rx.try_next() { + if let Poll::Ready(maybe_result) = rx.poll_next_unpin(cx) { return Poll::Ready(maybe_result); } - end_result.map(|()| None) + fut.poll_unpin(cx).map(|()| None) }) }