Skip to content

Commit 6a1701e

Browse files
committed
Use size_of_val instead of manual calculation
Very minor thing that I happened to notice in passing, but it's both shorter and means it gets `mul nuw`, so why not.
1 parent 8645296 commit 6a1701e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/hash/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ mod impls {
834834

835835
#[inline]
836836
fn hash_slice<H: ~const Hasher>(data: &[$ty], state: &mut H) {
837-
let newlen = data.len() * mem::size_of::<$ty>();
837+
let newlen = mem::size_of_val(data);
838838
let ptr = data.as_ptr() as *const u8;
839839
// SAFETY: `ptr` is valid and aligned, as this macro is only used
840840
// for numeric primitives which have no padding. The new slice only

0 commit comments

Comments
 (0)