We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 45b9a34 + 5d8431c commit 6517a0eCopy full SHA for 6517a0e
src/libcollections/vec.rs
@@ -1777,6 +1777,11 @@ impl<T> Iterator for IntoIter<T> {
1777
let exact = diff / (if size == 0 {1} else {size});
1778
(exact, Some(exact))
1779
}
1780
+
1781
+ #[inline]
1782
+ fn count(self) -> usize {
1783
+ self.size_hint().0
1784
+ }
1785
1786
1787
#[stable(feature = "rust1", since = "1.0.0")]
src/libcollectionstest/vec.rs
@@ -542,6 +542,11 @@ fn test_split_off() {
542
assert_eq!(vec2, [5, 6]);
543
544
545
+#[test]
546
+fn test_into_iter_count() {
547
+ assert_eq!(vec![1, 2, 3].into_iter().count(), 3);
548
+}
549
550
#[bench]
551
fn bench_new(b: &mut Bencher) {
552
b.iter(|| {
0 commit comments