mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-08 12:21:09 +03:00
cleanup unused macros and error (#3367)
This commit is contained in:
parent
ec3ea9c3ff
commit
105f50b26b
2 changed files with 0 additions and 43 deletions
|
@ -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
|
/// Utility struct to calculate commonly used Cuckoo parameters calculated
|
||||||
/// from header, nonce, edge_bits, etc.
|
/// from header, nonce, edge_bits, etc.
|
||||||
pub struct CuckooParams {
|
pub struct CuckooParams {
|
||||||
|
|
|
@ -29,9 +29,6 @@ pub enum ErrorKind {
|
||||||
/// Verification error
|
/// Verification error
|
||||||
#[fail(display = "Verification Error: {}", _0)]
|
#[fail(display = "Verification Error: {}", _0)]
|
||||||
Verification(String),
|
Verification(String),
|
||||||
/// Failure to cast from/to generic integer type
|
|
||||||
#[fail(display = "IntegerCast")]
|
|
||||||
IntegerCast,
|
|
||||||
/// IO Error
|
/// IO Error
|
||||||
#[fail(display = "IO Error")]
|
#[fail(display = "IO Error")]
|
||||||
IOError,
|
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 {
|
impl From<io::Error> for Error {
|
||||||
fn from(_error: io::Error) -> Error {
|
fn from(_error: io::Error) -> Error {
|
||||||
Error {
|
Error {
|
||||||
|
|
Loading…
Reference in a new issue