File tree Expand file tree Collapse file tree 4 files changed +16
-17
lines changed Expand file tree Collapse file tree 4 files changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -45,16 +45,14 @@ where
45
45
let mut left = this. left ;
46
46
let mut right = this. right ;
47
47
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 ( ) ) ) ;
52
51
}
53
52
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 ( ) ) ) ;
58
56
}
59
57
60
58
Poll :: Pending
Original file line number Diff line number Diff line change 1
- use std:: pin:: Pin ;
2
1
use std:: future:: Future ;
2
+ use std:: pin:: Pin ;
3
3
4
4
use pin_project_lite:: pin_project;
5
5
Original file line number Diff line number Diff line change
1
+ use pin_project_lite:: pin_project;
2
+ use std:: default:: Default ;
1
3
use std:: future:: Future ;
2
4
use std:: pin:: Pin ;
3
- use std:: default:: Default ;
4
- use pin_project_lite:: pin_project;
5
5
6
6
use crate :: stream:: Stream ;
7
7
use crate :: task:: { Context , Poll } ;
8
8
9
9
pin_project ! {
10
10
#[ derive( Debug ) ]
11
- #[ allow( missing_debug_implementations) ]
12
11
#[ cfg( all( feature = "default" , feature = "unstable" ) ) ]
13
12
#[ cfg_attr( feature = "docs" , doc( cfg( unstable) ) ) ]
14
13
pub struct PartitionFuture <S , F , B > {
@@ -46,10 +45,12 @@ where
46
45
match next {
47
46
Some ( v) => {
48
47
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
+ }
53
54
}
54
55
None => return Poll :: Ready ( this. res . take ( ) . unwrap ( ) ) ,
55
56
}
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ static POOL: Lazy<Pool> = Lazy::new(|| {
43
43
. name ( "async-std/executor" . to_string ( ) )
44
44
. spawn ( || {
45
45
let _ = PROCESSOR . with ( |p| p. set ( proc) ) ;
46
- abort_on_panic ( || main_loop ( ) ) ;
46
+ abort_on_panic ( main_loop) ;
47
47
} )
48
48
. expect ( "cannot start a thread driving tasks" ) ;
49
49
}
You can’t perform that action at this time.
0 commit comments