File tree 1 file changed +6
-11
lines changed 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change 1
1
#![ feature( test) ]
2
2
3
+ #[ macro_use]
3
4
extern crate futures;
4
5
extern crate futures_channel;
5
6
extern crate test;
@@ -111,17 +112,11 @@ impl Stream for TestSender {
111
112
type Error = ( ) ;
112
113
113
114
fn poll ( & mut self , cx : & mut task:: Context ) -> Poll < Option < Self :: Item > , Self :: Error > {
114
- match self . tx . start_send ( cx, self . last + 1 ) {
115
- Err ( _) => panic ! ( ) ,
116
- Ok ( Ok ( ( ) ) ) => {
117
- self . last += 1 ;
118
- assert_eq ! ( Ok ( Async :: Ready ( ( ) ) ) , self . tx. flush( cx) ) ;
119
- Ok ( Async :: Ready ( Some ( self . last ) ) )
120
- }
121
- Ok ( Err ( _) ) => {
122
- Ok ( Async :: Pending )
123
- }
124
- }
115
+ try_ready ! ( self . tx. poll_ready( cx) . map_err( |_| ( ) ) ) ;
116
+ self . tx . start_send ( self . last + 1 ) . unwrap ( ) ;
117
+ self . last += 1 ;
118
+ assert ! ( self . tx. poll_flush( cx) . unwrap( ) . is_ready( ) ) ;
119
+ Ok ( Async :: Ready ( Some ( self . last ) ) )
125
120
}
126
121
}
127
122
You can’t perform that action at this time.
0 commit comments