From 2b76da86ef940a54bac9aee77f54d0ae39e065f6 Mon Sep 17 00:00:00 2001 From: Marijn Schouten Date: Wed, 6 Apr 2022 09:54:43 +0200 Subject: [PATCH 1/3] Message: Chunks cannot have a size of zero. Add a message to the assertion that chunks cannot have a size of zero. --- library/core/src/slice/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 17f6373ecbf86..4f0f51d1a4ff4 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -814,7 +814,7 @@ impl [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] { #[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) } From 7660b2fd748f3b2fa6ddb230d94ff628a0d238dd Mon Sep 17 00:00:00 2001 From: Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> Date: Thu, 7 Apr 2022 04:44:11 +0200 Subject: [PATCH 2/3] remove exclamation mark Co-authored-by: Janusz Marcinkiewicz --- library/core/src/slice/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 4f0f51d1a4ff4..376ab41248d62 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -814,7 +814,7 @@ impl [T] { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn chunks(&self, chunk_size: usize) -> Chunks<'_, T> { - assert_ne!(chunk_size, 0, "Chunks cannot have a size of zero!"); + assert_ne!(chunk_size, 0, "chunks cannot have a size of zero"); Chunks::new(self, chunk_size) } From c331a9293a8a22f5111bdcdaf50b3dd5ac0838ce Mon Sep 17 00:00:00 2001 From: Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> Date: Thu, 7 Apr 2022 04:44:30 +0200 Subject: [PATCH 3/3] Update library/core/src/slice/mod.rs Co-authored-by: Janusz Marcinkiewicz --- library/core/src/slice/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 376ab41248d62..78fad46e7937e 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -852,7 +852,7 @@ impl [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, "Chunks cannot have a size of zero!"); + assert_ne!(chunk_size, 0, "chunks cannot have a size of zero"); ChunksMut::new(self, chunk_size) }