Turn on clippy for Rust and fix lints for non-generated code (#7575)

Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
Casper
2022-10-10 21:26:35 -04:00
committed by GitHub
parent b80142b901
commit e1c5db988a
14 changed files with 38 additions and 42 deletions

View File

@@ -179,10 +179,6 @@ pub unsafe fn read_scalar<T: EndianScalar>(s: &[u8]) -> T {
let mut mem = core::mem::MaybeUninit::<T::Scalar>::uninit();
// Since [u8] has alignment 1, we copy it into T which may have higher alignment.
core::ptr::copy_nonoverlapping(
s.as_ptr(),
mem.as_mut_ptr() as *mut u8,
size,
);
core::ptr::copy_nonoverlapping(s.as_ptr(), mem.as_mut_ptr() as *mut u8, size);
T::from_little_endian(mem.assume_init())
}