@@ -45,26 +45,25 @@ where
4545 fn poll_next ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Option < Self :: Item > > {
4646 let this = self . project ( ) ;
4747 if utils:: random ( 1 ) == 1 {
48- poll_next_in_order ( cx, this. left , this. right )
48+ match this. left . poll_next ( cx) {
49+ Poll :: Ready ( Some ( item) ) => Poll :: Ready ( Some ( item) ) ,
50+ Poll :: Ready ( None ) => this. right . poll_next ( cx) ,
51+ Poll :: Pending => match this. right . poll_next ( cx) {
52+ Poll :: Ready ( Some ( item) ) => Poll :: Ready ( Some ( item) ) ,
53+ Poll :: Ready ( None ) => Poll :: Pending ,
54+ Poll :: Pending => Poll :: Pending ,
55+ } ,
56+ }
4957 } else {
50- poll_next_in_order ( cx, this. right , this. left )
58+ match this. right . poll_next ( cx) {
59+ Poll :: Ready ( Some ( item) ) => Poll :: Ready ( Some ( item) ) ,
60+ Poll :: Ready ( None ) => this. left . poll_next ( cx) ,
61+ Poll :: Pending => match this. left . poll_next ( cx) {
62+ Poll :: Ready ( Some ( item) ) => Poll :: Ready ( Some ( item) ) ,
63+ Poll :: Ready ( None ) => Poll :: Pending ,
64+ Poll :: Pending => Poll :: Pending ,
65+ } ,
66+ }
5167 }
5268 }
5369}
54-
55- /// Pools the next item, trying in order, first the first item, then the second one.
56- fn poll_next_in_order < F , S , T > ( cx : & mut Context < ' _ > , first : F , second : S ) -> Poll < Option < T > >
57- where
58- F : Stream < Item = T > ,
59- S : Stream < Item = T > ,
60- {
61- match first. poll_next ( cx) {
62- Poll :: Ready ( Some ( item) ) => Poll :: Ready ( Some ( item) ) ,
63- Poll :: Ready ( None ) => second. poll_next ( cx) ,
64- Poll :: Pending => match second. poll_next ( cx) {
65- Poll :: Ready ( Some ( item) ) => Poll :: Ready ( Some ( item) ) ,
66- Poll :: Ready ( None ) => Poll :: Pending ,
67- Poll :: Pending => Poll :: Pending ,
68- } ,
69- }
70- }
0 commit comments