Skip to content

Commit 9e0c558

Browse files
committed
Simplify result .as_bytes()
1 parent 3917a83 commit 9e0c558

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/blake2.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ macro_rules! blake2_impl {
4444
use std::cmp;
4545
use std::fmt::{self, Debug};
4646
use std::io;
47-
use std::mem;
48-
use std::slice;
4947

5048
use $crate::as_bytes::AsBytes;
5149
use $crate::bytes::{MutableByteVector, copy_memory};
@@ -64,18 +62,9 @@ macro_rules! blake2_impl {
6462
}
6563

6664
impl $result {
67-
#[inline]
68-
fn as_slice(&self) -> &[u8] {
69-
unsafe {
70-
slice::from_raw_parts(
71-
self.h.as_ptr() as *const u8,
72-
mem::size_of_val(&self.h))
73-
}
74-
}
75-
7665
/// Returns the contained hash result as a byte string.
7766
#[inline]
78-
pub fn as_bytes(&self) -> &[u8] { &self.as_slice()[..self.nn] }
67+
pub fn as_bytes(&self) -> &[u8] { &self.h.as_bytes()[..self.nn] }
7968

8069
/// Returns the length of the hash result.
8170
///

0 commit comments

Comments
 (0)