diff --git a/src/future/future/join.rs b/src/future/future/join.rs index 90ea323..5cfbd99 100644 --- a/src/future/future/join.rs +++ b/src/future/future/join.rs @@ -45,16 +45,14 @@ where let mut left = this.left; let mut right = this.right; - if Future::poll(Pin::new(&mut left), cx).is_ready() { - if right.as_ref().output().is_some() { - return Poll::Ready((left.take().unwrap(), right.take().unwrap())); - } + let is_left_ready = Future::poll(Pin::new(&mut left), cx).is_ready(); + if is_left_ready && right.as_ref().output().is_some() { + return Poll::Ready((left.take().unwrap(), right.take().unwrap())); } - if Future::poll(Pin::new(&mut right), cx).is_ready() { - if left.as_ref().output().is_some() { - return Poll::Ready((left.take().unwrap(), right.take().unwrap())); - } + let is_right_ready = Future::poll(Pin::new(&mut right), cx).is_ready(); + if is_right_ready && left.as_ref().output().is_some() { + return Poll::Ready((left.take().unwrap(), right.take().unwrap())); } Poll::Pending diff --git a/src/stream/stream/last.rs b/src/stream/stream/last.rs index 188da3c..60f8806 100644 --- a/src/stream/stream/last.rs +++ b/src/stream/stream/last.rs @@ -1,5 +1,5 @@ -use std::pin::Pin; use std::future::Future; +use std::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/partition.rs b/src/stream/stream/partition.rs index ba4938c..077d4ec 100644 --- a/src/stream/stream/partition.rs +++ b/src/stream/stream/partition.rs @@ -1,14 +1,13 @@ +use pin_project_lite::pin_project; +use std::default::Default; use std::future::Future; use std::pin::Pin; -use std::default::Default; -use pin_project_lite::pin_project; use crate::stream::Stream; use crate::task::{Context, Poll}; pin_project! { #[derive(Debug)] - #[allow(missing_debug_implementations)] #[cfg(all(feature = "default", feature = "unstable"))] #[cfg_attr(feature = "docs", doc(cfg(unstable)))] pub struct PartitionFuture { @@ -46,10 +45,12 @@ where match next { Some(v) => { let mut res = this.res.take().unwrap(); - match (this.f)(&v) { - true => res.0.extend(Some(v)), - false => res.1.extend(Some(v)), - }; + + if (this.f)(&v) { + res.0.extend(Some(v)) + } else { + res.1.extend(Some(v)) + } *this.res = Some(res); } diff --git a/src/task/executor/pool.rs b/src/task/executor/pool.rs index 08694dd..5249b3d 100644 --- a/src/task/executor/pool.rs +++ b/src/task/executor/pool.rs @@ -43,7 +43,7 @@ static POOL: Lazy = Lazy::new(|| { .name("async-std/executor".to_string()) .spawn(|| { let _ = PROCESSOR.with(|p| p.set(proc)); - abort_on_panic(|| main_loop()); + abort_on_panic(main_loop); }) .expect("cannot start a thread driving tasks"); }