cleanup unused macros and error (#3367)

This commit is contained in:
Antioch Peverell 2020-07-27 11:06:16 +01:00 committed by GitHub
parent ec3ea9c3ff
commit 105f50b26b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 43 deletions

View file

@ -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 {

View file

@ -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<Context<ErrorKind>> for Error {
}
}
impl From<fmt::Error> for Error {
fn from(_error: fmt::Error) -> Error {
Error {
inner: Context::new(ErrorKind::IntegerCast),
}
}
}
impl From<io::Error> for Error {
fn from(_error: io::Error) -> Error {
Error {