Message: Chunks cannot have a size of zero.

Add a message to the assertion that chunks cannot have a size of zero.
This commit is contained in:
Marijn Schouten 2022-04-06 09:54:43 +02:00 committed by GitHub
parent 5da76eeaad
commit 2b76da86ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -814,7 +814,7 @@ impl<T> [T] {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn chunks(&self, chunk_size: usize) -> Chunks<'_, T> {
assert_ne!(chunk_size, 0);
assert_ne!(chunk_size, 0, "Chunks cannot have a size of zero!");
Chunks::new(self, chunk_size)
}
@ -852,7 +852,7 @@ impl<T> [T] {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<'_, T> {
assert_ne!(chunk_size, 0);
assert_ne!(chunk_size, 0, "Chunks cannot have a size of zero!");
ChunksMut::new(self, chunk_size)
}