@@ -2,8 +2,8 @@ use std::cmp::Ordering;
22use std:: pin:: Pin ;
33
44use super :: fuse:: Fuse ;
5- use crate :: future:: Future ;
65use crate :: prelude:: * ;
6+ use crate :: future:: Future ;
77use crate :: stream:: Stream ;
88use crate :: task:: { Context , Poll } ;
99
@@ -15,7 +15,7 @@ pub struct PartialCmpFuture<L: Stream, R: Stream> {
1515 l : Fuse < L > ,
1616 r : Fuse < R > ,
1717 l_cache : Option < L :: Item > ,
18- r_cache : Option < R :: Item > ,
18+ r_cache : Option < R :: Item > ,
1919}
2020
2121impl < L : Stream , R : Stream > PartialCmpFuture < L , R > {
@@ -28,36 +28,36 @@ impl<L: Stream, R: Stream> PartialCmpFuture<L, R> {
2828 PartialCmpFuture {
2929 l : l. fuse ( ) ,
3030 r : r. fuse ( ) ,
31- l_cache : None ,
32- r_cache : None ,
31+ l_cache : None ,
32+ r_cache : None ,
3333 }
3434 }
3535}
3636
37- impl < L : Stream , R : Stream > Future for PartialCmpFuture < L , R >
38- where
37+ impl < L : Stream , R : Stream > Future for PartialCmpFuture < L , R >
38+ where
3939 L : Stream + Sized ,
4040 R : Stream + Sized ,
41- L :: Item : PartialOrd < R :: Item > ,
41+ L :: Item : PartialOrd < R :: Item >
4242{
4343 type Output = Option < Ordering > ;
4444
45- fn poll ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Self :: Output > {
45+ fn poll ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Self :: Output > {
4646 loop {
47- // Short circuit logic
47+ // Short circuit logic
4848 // Stream that completes earliest can be considered Less, etc
4949 let l_complete = self . l . done && self . as_mut ( ) . l_cache . is_none ( ) ;
5050 let r_complete = self . r . done && self . as_mut ( ) . r_cache . is_none ( ) ;
5151
5252 if l_complete && r_complete {
53- return Poll :: Ready ( Some ( Ordering :: Equal ) ) ;
53+ return Poll :: Ready ( Some ( Ordering :: Equal ) )
5454 } else if l_complete {
55- return Poll :: Ready ( Some ( Ordering :: Less ) ) ;
55+ return Poll :: Ready ( Some ( Ordering :: Less ) )
5656 } else if r_complete {
57- return Poll :: Ready ( Some ( Ordering :: Greater ) ) ;
57+ return Poll :: Ready ( Some ( Ordering :: Greater ) )
5858 }
5959
60- // Get next value if possible and necesary
60+ // Get next value if possible and necesary
6161 if !self . l . done && self . as_mut ( ) . l_cache . is_none ( ) {
6262 let l_next = futures_core:: ready!( self . as_mut( ) . l( ) . poll_next( cx) ) ;
6363 if let Some ( item) = l_next {
@@ -75,17 +75,17 @@ where
7575 // Compare if both values are available.
7676 if self . as_mut ( ) . l_cache . is_some ( ) && self . as_mut ( ) . r_cache . is_some ( ) {
7777 let l_value = self . as_mut ( ) . l_cache ( ) . take ( ) . unwrap ( ) ;
78- let r_value = self . as_mut ( ) . r_cache ( ) . take ( ) . unwrap ( ) ;
78+ let r_value = self . as_mut ( ) . r_cache ( ) . take ( ) . unwrap ( ) ;
7979 let result = l_value. partial_cmp ( & r_value) ;
8080
8181 if let Some ( Ordering :: Equal ) = result {
82- // Reset cache to prepare for next comparison
83- * self . as_mut ( ) . l_cache ( ) = None ;
82+ // Reset cache to prepare for next comparison
83+ * self . as_mut ( ) . l_cache ( ) = None ;
8484 * self . as_mut ( ) . r_cache ( ) = None ;
8585 } else {
86- // Return non equal value
86+ // Return non equal value
8787 return Poll :: Ready ( result) ;
88- }
88+ }
8989 }
9090 }
9191 }
0 commit comments