diff options
Diffstat (limited to 'src/peeking_take_while.rs')
-rw-r--r-- | src/peeking_take_while.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/peeking_take_while.rs b/src/peeking_take_while.rs index b404904..70ef988 100644 --- a/src/peeking_take_while.rs +++ b/src/peeking_take_while.rs @@ -1,6 +1,6 @@ use std::iter::Peekable; use crate::PutBack; -#[cfg(feature = "use_std")] +#[cfg(feature = "use_alloc")] use crate::PutBackN; /// An iterator that allows peeking at an element before deciding to accept it. @@ -52,7 +52,7 @@ impl<I> PeekingNext for PutBack<I> } } -#[cfg(feature = "use_std")] +#[cfg(feature = "use_alloc")] impl<I> PeekingNext for PutBackN<I> where I: Iterator, { @@ -104,8 +104,7 @@ impl<'a, I, F> Iterator for PeekingTakeWhile<'a, I, F> } fn size_hint(&self) -> (usize, Option<usize>) { - let (_, hi) = self.iter.size_hint(); - (0, hi) + (0, self.iter.size_hint().1) } } @@ -138,10 +137,10 @@ peeking_next_by_clone! { ['a] ::std::str::Bytes<'a> } peeking_next_by_clone! { ['a, T] ::std::option::Iter<'a, T> } peeking_next_by_clone! { ['a, T] ::std::result::Iter<'a, T> } peeking_next_by_clone! { [T] ::std::iter::Empty<T> } -#[cfg(feature = "use_std")] -peeking_next_by_clone! { ['a, T] ::std::collections::linked_list::Iter<'a, T> } -#[cfg(feature = "use_std")] -peeking_next_by_clone! { ['a, T] ::std::collections::vec_deque::Iter<'a, T> } +#[cfg(feature = "use_alloc")] +peeking_next_by_clone! { ['a, T] alloc::collections::linked_list::Iter<'a, T> } +#[cfg(feature = "use_alloc")] +peeking_next_by_clone! { ['a, T] alloc::collections::vec_deque::Iter<'a, T> } // cloning a Rev has no extra overhead; peekable and put backs are never DEI. peeking_next_by_clone! { [I: Clone + PeekingNext + DoubleEndedIterator] |