Skip to content

Commit 0fba3db

Browse files
committed
Fix futures-channel benches
1 parent f50e2d2 commit 0fba3db

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

futures-channel/benches/sync_mpsc.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![feature(test)]
22

3+
#[macro_use]
34
extern crate futures;
45
extern crate futures_channel;
56
extern crate test;
@@ -111,17 +112,11 @@ impl Stream for TestSender {
111112
type Error = ();
112113

113114
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)))
125120
}
126121
}
127122

0 commit comments

Comments
 (0)