Skip to content

Fix clippy warn #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/future/future/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/stream/stream/last.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::pin::Pin;
use std::future::Future;
use std::pin::Pin;

use pin_project_lite::pin_project;

Expand Down
15 changes: 8 additions & 7 deletions src/stream/stream/partition.rs
Original file line number Diff line number Diff line change
@@ -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<S, F, B> {
Expand Down Expand Up @@ -46,10 +45,12 @@ where
match next {
Some(v) => {
let res = this.res.as_mut().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))
}
}
None => return Poll::Ready(this.res.take().unwrap()),
}
Expand Down
2 changes: 1 addition & 1 deletion src/task/executor/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static POOL: Lazy<Pool> = 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");
}
Expand Down