taproot: Use error variants locally
Add 'use Error::*' locally to make the code more terse.
This commit is contained in:
parent
6a04ca12e0
commit
d86517ae4f
|
@ -73,12 +73,13 @@ pub enum Error {
|
||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
use Error::*;
|
||||||
|
|
||||||
match *self {
|
match *self {
|
||||||
Error::InvalidSighashType(hash_ty) =>
|
InvalidSighashType(hash_ty) => write!(f, "invalid signature hash type {}", hash_ty),
|
||||||
write!(f, "invalid signature hash type {}", hash_ty),
|
Secp256k1(ref e) =>
|
||||||
Error::Secp256k1(ref e) =>
|
|
||||||
write_err!(f, "taproot signature has correct len but is malformed"; e),
|
write_err!(f, "taproot signature has correct len but is malformed"; e),
|
||||||
Error::InvalidSignatureSize(sz) => write!(f, "invalid taproot signature size: {}", sz),
|
InvalidSignatureSize(sz) => write!(f, "invalid taproot signature size: {}", sz),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +87,7 @@ impl fmt::Display for Error {
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl std::error::Error for Error {
|
impl std::error::Error for Error {
|
||||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||||
use self::Error::*;
|
use Error::*;
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
Secp256k1(e) => Some(e),
|
Secp256k1(e) => Some(e),
|
||||||
|
|
Loading…
Reference in New Issue