diff --git a/library/core/src/slice/iter.rs b/library/core/src/slice/iter.rs index 8f52fa852ba9..730009568dd3 100644 --- a/library/core/src/slice/iter.rs +++ b/library/core/src/slice/iter.rs @@ -3009,6 +3009,15 @@ where P: FnMut(&T, &T) -> bool, Some(head) } } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + if self.slice.is_empty() { + (0, Some(0)) + } else { + (1, Some(self.slice.len())) + } + } } #[unstable(feature = "slice_group_by", issue = "0")] @@ -3080,6 +3089,15 @@ where P: FnMut(&T, &T) -> bool, Some(head) } } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + if self.slice.is_empty() { + (0, Some(0)) + } else { + (1, Some(self.slice.len())) + } + } } #[unstable(feature = "slice_group_by", issue = "0")]