Skip to content

Commit

Permalink
CircularTupleWindows does not need phantom data
Browse files Browse the repository at this point in the history
After I randomly took a look at this, I realized this field never was needed because `iter` type owns a `T`. I should have realized that last time I updated this struct.
I checked other phantom data fields in the library but that's the only useless one.
  • Loading branch information
Philippe-Cholet committed Nov 25, 2023
1 parent 76ebb25 commit fcc684c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/tuple_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use std::iter::Cycle;
use std::iter::Fuse;
use std::iter::FusedIterator;
use std::marker::PhantomData;

use crate::size_hint;

Expand Down Expand Up @@ -252,7 +251,6 @@ where
{
iter: TupleWindows<Cycle<I>, T>,
len: usize,
phantom_data: PhantomData<T>,
}

pub fn circular_tuple_windows<I, T>(iter: I) -> CircularTupleWindows<I, T>
Expand All @@ -264,11 +262,7 @@ where
let len = iter.len();
let iter = tuple_windows(iter.cycle());

CircularTupleWindows {
iter,
len,
phantom_data: PhantomData {},
}
CircularTupleWindows { iter, len }
}

impl<I, T> Iterator for CircularTupleWindows<I, T>
Expand Down

0 comments on commit fcc684c

Please sign in to comment.