From 6b0c2fd1d6caf3317da930912b9dc85ed92747f7 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sun, 24 Jun 2018 20:11:56 +0200 Subject: [PATCH] Use assert_eq! in copy_from_slice This will print both lengths when the assertion fails instead of just saying that they're different. --- src/libcore/slice/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 6f4c130d8f318..e4ed5f61d1c79 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -1642,8 +1642,8 @@ impl [T] { /// [`split_at_mut`]: #method.split_at_mut #[stable(feature = "copy_from_slice", since = "1.9.0")] pub fn copy_from_slice(&mut self, src: &[T]) where T: Copy { - assert!(self.len() == src.len(), - "destination and source slices have different lengths"); + assert_eq!(self.len(), src.len(), + "destination and source slices have different lengths"); unsafe { ptr::copy_nonoverlapping( src.as_ptr(), self.as_mut_ptr(), self.len());