Skip to content

Commit 6b0c2fd

Browse files
Use assert_eq! in copy_from_slice
This will print both lengths when the assertion fails instead of just saying that they're different.
1 parent 01cc982 commit 6b0c2fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/slice/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1642,8 +1642,8 @@ impl<T> [T] {
16421642
/// [`split_at_mut`]: #method.split_at_mut
16431643
#[stable(feature = "copy_from_slice", since = "1.9.0")]
16441644
pub fn copy_from_slice(&mut self, src: &[T]) where T: Copy {
1645-
assert!(self.len() == src.len(),
1646-
"destination and source slices have different lengths");
1645+
assert_eq!(self.len(), src.len(),
1646+
"destination and source slices have different lengths");
16471647
unsafe {
16481648
ptr::copy_nonoverlapping(
16491649
src.as_ptr(), self.as_mut_ptr(), self.len());

0 commit comments

Comments
 (0)