Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blake2: fixup rustc 1.78 warnings #580

Merged
merged 1 commit into from
May 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions blake2/src/as_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,13 @@ pub unsafe trait Safe {}

pub trait AsBytes {
fn as_bytes(&self) -> &[u8];
fn as_mut_bytes(&mut self) -> &mut [u8];
}

impl<T: Safe> AsBytes for [T] {
#[inline]
fn as_bytes(&self) -> &[u8] {
unsafe { slice::from_raw_parts(self.as_ptr() as *const u8, mem::size_of_val(self)) }
}

#[inline]
fn as_mut_bytes(&mut self) -> &mut [u8] {
unsafe { slice::from_raw_parts_mut(self.as_mut_ptr() as *mut u8, mem::size_of_val(self)) }
}
}

unsafe impl Safe for u8 {}
Expand Down
Loading