Skip to content

Commit 8ea920c

Browse files
authored
Merge pull request #546 from k-nasa/fix_clippy
Fix clippy warn
2 parents d1189f9 + 76975a4 commit 8ea920c

File tree

4 files changed

+16
-17
lines changed

4 files changed

+16
-17
lines changed

src/future/future/join.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,14 @@ where
4545
let mut left = this.left;
4646
let mut right = this.right;
4747

48-
if Future::poll(Pin::new(&mut left), cx).is_ready() {
49-
if right.as_ref().output().is_some() {
50-
return Poll::Ready((left.take().unwrap(), right.take().unwrap()));
51-
}
48+
let is_left_ready = Future::poll(Pin::new(&mut left), cx).is_ready();
49+
if is_left_ready && right.as_ref().output().is_some() {
50+
return Poll::Ready((left.take().unwrap(), right.take().unwrap()));
5251
}
5352

54-
if Future::poll(Pin::new(&mut right), cx).is_ready() {
55-
if left.as_ref().output().is_some() {
56-
return Poll::Ready((left.take().unwrap(), right.take().unwrap()));
57-
}
53+
let is_right_ready = Future::poll(Pin::new(&mut right), cx).is_ready();
54+
if is_right_ready && left.as_ref().output().is_some() {
55+
return Poll::Ready((left.take().unwrap(), right.take().unwrap()));
5856
}
5957

6058
Poll::Pending

src/stream/stream/last.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::pin::Pin;
21
use std::future::Future;
2+
use std::pin::Pin;
33

44
use pin_project_lite::pin_project;
55

src/stream/stream/partition.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1+
use pin_project_lite::pin_project;
2+
use std::default::Default;
13
use std::future::Future;
24
use std::pin::Pin;
3-
use std::default::Default;
4-
use pin_project_lite::pin_project;
55

66
use crate::stream::Stream;
77
use crate::task::{Context, Poll};
88

99
pin_project! {
1010
#[derive(Debug)]
11-
#[allow(missing_debug_implementations)]
1211
#[cfg(all(feature = "default", feature = "unstable"))]
1312
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
1413
pub struct PartitionFuture<S, F, B> {
@@ -46,10 +45,12 @@ where
4645
match next {
4746
Some(v) => {
4847
let res = this.res.as_mut().unwrap();
49-
match (this.f)(&v) {
50-
true => res.0.extend(Some(v)),
51-
false => res.1.extend(Some(v)),
52-
};
48+
49+
if (this.f)(&v) {
50+
res.0.extend(Some(v))
51+
} else {
52+
res.1.extend(Some(v))
53+
}
5354
}
5455
None => return Poll::Ready(this.res.take().unwrap()),
5556
}

src/task/executor/pool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static POOL: Lazy<Pool> = Lazy::new(|| {
4343
.name("async-std/executor".to_string())
4444
.spawn(|| {
4545
let _ = PROCESSOR.with(|p| p.set(proc));
46-
abort_on_panic(|| main_loop());
46+
abort_on_panic(main_loop);
4747
})
4848
.expect("cannot start a thread driving tasks");
4949
}

0 commit comments

Comments
 (0)