2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-01-30 09:15:33 +00:00

use the module operator to calculate next index

This commit is contained in:
Felipe Sere 2019-10-24 16:40:27 -05:00
parent 486f9a964c
commit 8126bb1882

View file

@ -22,11 +22,7 @@ impl<T: Copy> Stream for Cycle<T> {
let next = self.index + 1;
if next >= self.len {
self.as_mut().index = 0;
} else {
self.as_mut().index = next;
}
self.as_mut().index = next % self.len;
Poll::Ready(Some(value))
}