From 8c554e05ae1c0dae75defb0db2986e01befcbcd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20H=C3=BCgel?= Date: Sat, 20 Feb 2016 08:52:54 +0000 Subject: [PATCH 1/2] Clarify chunks() and chunks_mut() iterator content Closes #31773 --- src/libcollections/slice.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 6252e4888eb3c..e431a7c08b9b6 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -406,7 +406,7 @@ impl [T] { core_slice::SliceExt::windows(self, size) } - /// Returns an iterator over `size` elements of the slice at a + /// Returns an iterator over `size` slices of the slice at a /// time. The chunks do not overlap. If `size` does not divide the /// length of the slice, then the last chunk will not have length /// `size`. @@ -432,7 +432,7 @@ impl [T] { core_slice::SliceExt::chunks(self, size) } - /// Returns an iterator over `chunk_size` elements of the slice at a time. + /// Returns an iterator over `chunk_size` slices of the slice at a time. /// The chunks are mutable and do not overlap. If `chunk_size` does /// not divide the length of the slice, then the last chunk will not /// have length `chunk_size`. From 41a63bdcab788938a27a46a8f73b834f94600549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20H=C3=BCgel?= Date: Sat, 20 Feb 2016 09:04:15 +0000 Subject: [PATCH 2/2] Correct size of returned iterator The methods don't return `size` slices, but rather slices of `size` elements. Sorry! --- src/libcollections/slice.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index e431a7c08b9b6..eab69088aa2b9 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -406,8 +406,8 @@ impl [T] { core_slice::SliceExt::windows(self, size) } - /// Returns an iterator over `size` slices of the slice at a - /// time. The chunks do not overlap. If `size` does not divide the + /// Returns an iterator over `size` elements of the slice at a + /// time. The chunks are slices and do not overlap. If `size` does not divide the /// length of the slice, then the last chunk will not have length /// `size`. /// @@ -432,8 +432,8 @@ impl [T] { core_slice::SliceExt::chunks(self, size) } - /// Returns an iterator over `chunk_size` slices of the slice at a time. - /// The chunks are mutable and do not overlap. If `chunk_size` does + /// Returns an iterator over `chunk_size` elements of the slice at a time. + /// The chunks are mutable slices, and do not overlap. If `chunk_size` does /// not divide the length of the slice, then the last chunk will not /// have length `chunk_size`. ///