Skip to content

Commit

Permalink
blake2: fixup rustc 1.78 warnings
Browse files Browse the repository at this point in the history
Starting 1.78, rust will report the `as_mut_bytes` method is dead code.

I believe rustc is correct.
  • Loading branch information
baloo committed May 11, 2024
1 parent 470c789 commit ca7590b
Showing 1 changed file with 0 additions and 6 deletions.
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

0 comments on commit ca7590b

Please sign in to comment.