From 34b47f2eae8c9744fd66d9d37e9695078aa18fad Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts <2467194+yoshuawuyts@users.noreply.github.com> Date: Wed, 16 Nov 2022 15:36:08 +0100 Subject: [PATCH] push fixes from #79 --- src/stream/merge/vec.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/stream/merge/vec.rs b/src/stream/merge/vec.rs index e17b741..5c13bfe 100644 --- a/src/stream/merge/vec.rs +++ b/src/stream/merge/vec.rs @@ -26,7 +26,6 @@ where wakers: WakerList, state: PollStates, done: bool, - len: usize, } impl Merge @@ -42,7 +41,6 @@ where rng: RandomGenerator::new(), complete: 0, done: false, - len, } } } @@ -71,8 +69,8 @@ where // Iterate over our streams one-by-one. If a stream yields a value, // we exit early. By default we'll return `Poll::Ready(None)`, but // this changes if we encounter a `Poll::Pending`. - let len = *this.len; - let r = this.rng.generate(this.streams.len() as u32) as usize; + let len = this.streams.len(); + let r = this.rng.generate(len as u32) as usize; for index in (0..len).map(|n| (r + n).wrapping_rem(len)) { if !readiness.any_ready() { // Nothing is ready yet