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:
parent
486f9a964c
commit
8126bb1882
1 changed files with 1 additions and 5 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue