removed unsafe code (#1466)

This commit is contained in:
Marek Kotewicz
2016-06-28 11:52:59 +02:00
committed by Gav Wood
parent 6895a56099
commit 4f56f8b27c
3 changed files with 5 additions and 25 deletions

View File

@@ -557,7 +557,7 @@ macro_rules! construct_uint {
($name:ident, $n_words:expr) => (
/// Little-endian large integer type
#[repr(C)]
#[derive(Copy, Clone, Eq, PartialEq)]
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
pub struct $name(pub [u64; $n_words]);
impl Uint for $name {
@@ -1126,14 +1126,6 @@ macro_rules! construct_uint {
Ok(())
}
}
#[cfg_attr(feature="dev", allow(derive_hash_xor_eq))] // We are pretty sure it's ok.
impl Hash for $name {
fn hash<H>(&self, state: &mut H) where H: Hasher {
unsafe { state.write(::std::slice::from_raw_parts(self.0.as_ptr() as *mut u8, self.0.len() * 8)); }
state.finish();
}
}
);
}