From 105f50b26b4ff961a402f4d9e14ba303c50450ab Mon Sep 17 00:00:00 2001 From: Antioch Peverell Date: Mon, 27 Jul 2020 11:06:16 +0100 Subject: [PATCH] cleanup unused macros and error (#3367) --- core/src/pow/common.rs | 32 -------------------------------- core/src/pow/error.rs | 11 ----------- 2 files changed, 43 deletions(-) diff --git a/core/src/pow/common.rs b/core/src/pow/common.rs index a12139daf..ddb24eb86 100644 --- a/core/src/pow/common.rs +++ b/core/src/pow/common.rs @@ -79,38 +79,6 @@ pub fn create_siphash_keys(header: &[u8]) -> Result<[u64; 4], Error> { ]) } -/// Macro to clean up u64 unwrapping -#[macro_export] -macro_rules! to_u64 { - ($n:expr) => { - $n.to_u64().ok_or(ErrorKind::IntegerCast)? - }; -} - -/// Macro to clean up u64 unwrapping as u32 -#[macro_export] -macro_rules! to_u32 { - ($n:expr) => { - $n.to_u64().ok_or(ErrorKind::IntegerCast)? as u32 - }; -} - -/// Macro to clean up u64 unwrapping as usize -#[macro_export] -macro_rules! to_usize { - ($n:expr) => { - $n.to_u64().ok_or(ErrorKind::IntegerCast)? as usize - }; -} - -/// Macro to clean up casting to edge type -#[macro_export] -macro_rules! to_edge { - ($edge_type:ident, $n:expr) => { - $edge_type::from($n).ok_or(ErrorKind::IntegerCast)? - }; -} - /// Utility struct to calculate commonly used Cuckoo parameters calculated /// from header, nonce, edge_bits, etc. pub struct CuckooParams { diff --git a/core/src/pow/error.rs b/core/src/pow/error.rs index bbcff4c92..946ac26b0 100644 --- a/core/src/pow/error.rs +++ b/core/src/pow/error.rs @@ -29,9 +29,6 @@ pub enum ErrorKind { /// Verification error #[fail(display = "Verification Error: {}", _0)] Verification(String), - /// Failure to cast from/to generic integer type - #[fail(display = "IntegerCast")] - IntegerCast, /// IO Error #[fail(display = "IO Error")] IOError, @@ -89,14 +86,6 @@ impl From> for Error { } } -impl From for Error { - fn from(_error: fmt::Error) -> Error { - Error { - inner: Context::new(ErrorKind::IntegerCast), - } - } -} - impl From for Error { fn from(_error: io::Error) -> Error { Error {