merge_streams: shorten the code a tiny bit

This commit is contained in:
Igor Katson 2024-09-16 23:11:01 +01:00
parent d9a56acacb
commit decf29a910
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5

View file

@ -36,11 +36,7 @@ fn poll_two<I, S1: Stream<Item = I> + Unpin, S2: Stream<Item = I> + Unpin>(
let s1p = s1.poll_next_unpin(cx);
match s1p {
Poll::Ready(Some(v)) => Poll::Ready(Some(v)),
Poll::Ready(None) => match s2.poll_next_unpin(cx) {
Poll::Ready(Some(v)) => Poll::Ready(Some(v)),
Poll::Ready(None) => Poll::Ready(None),
Poll::Pending => Poll::Pending,
},
Poll::Ready(None) => s2.poll_next_unpin(cx),
Poll::Pending => match s2.poll_next_unpin(cx) {
Poll::Ready(Some(v)) => Poll::Ready(Some(v)),
Poll::Ready(None) | Poll::Pending => Poll::Pending,