Skip to content

Commit

Permalink
Use assert_eq! in copy_from_slice
Browse files Browse the repository at this point in the history
This will print both lengths when the assertion fails instead of just saying that they're different.
  • Loading branch information
jonas-schievink authored Jun 24, 2018
1 parent 01cc982 commit 6b0c2fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1642,8 +1642,8 @@ impl<T> [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());
Expand Down

0 comments on commit 6b0c2fd

Please sign in to comment.