Skip to content

Commit

Permalink
Fix remove use of fuse at tuple_windows
Browse files Browse the repository at this point in the history
  • Loading branch information
aobatact authored and jswrenn committed Oct 3, 2023
1 parent 6c6aa7e commit 25b1149
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/tuple_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ where
I: Iterator<Item = T::Item>,
T: HomogeneousTuple,
{
iter: Fuse<I>,
iter: I,
last: Option<T>,
}

Expand All @@ -180,7 +180,7 @@ where
{
TupleWindows {
last : None,
iter : iter.fuse(),
iter,
}
}

Expand All @@ -196,20 +196,19 @@ where
if T::num_items() == 1 {
return T::collect_from_iter_no_buf(&mut self.iter);
}
if let Some(ref mut last) = self.last {
if let Some(new) = self.iter.next() {
if let Some(new) = self.iter.next() {
if let Some(ref mut last) = self.last {
last.left_shift_push(new);
return Some(last.clone());
}
} else {
use std::iter::once;
if let Some(item) = self.iter.next() {
let iter = once(item).chain(&mut self.iter);
Some(last.clone())
} else {
use std::iter::once;
let iter = once(new).chain(&mut self.iter);
self.last = T::collect_from_iter_no_buf(iter);
return self.last.clone();
self.last.clone()
}
} else {
None
}
None
}

fn size_hint(&self) -> (usize, Option<usize>) {
Expand Down

0 comments on commit 25b1149

Please sign in to comment.