Clean up error type from impls
Make the `From` impls conform to our convention. Refactor only, no logic changes.
This commit is contained in:
parent
36aa627d83
commit
482c8cb7f8
|
@ -241,15 +241,15 @@ impl std::error::Error for Error {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<secp256k1::Error> for Error {
|
impl From<secp256k1::Error> for Error {
|
||||||
fn from(e: secp256k1::Error) -> Error { Error::Secp256k1(e) }
|
fn from(e: secp256k1::Error) -> Self { Self::Secp256k1(e) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<NonStandardSighashTypeError> for Error {
|
impl From<NonStandardSighashTypeError> for Error {
|
||||||
fn from(err: NonStandardSighashTypeError) -> Self { Error::SighashType(err) }
|
fn from(e: NonStandardSighashTypeError) -> Self { Self::SighashType(e) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<hex::HexToBytesError> for Error {
|
impl From<hex::HexToBytesError> for Error {
|
||||||
fn from(err: hex::HexToBytesError) -> Self { Error::Hex(err) }
|
fn from(e: hex::HexToBytesError) -> Self { Self::Hex(e) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -921,7 +921,7 @@ impl std::error::Error for FromSliceError {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<secp256k1::Error> for FromSliceError {
|
impl From<secp256k1::Error> for FromSliceError {
|
||||||
fn from(e: secp256k1::Error) -> FromSliceError { Self::Secp256k1(e) }
|
fn from(e: secp256k1::Error) -> Self { Self::Secp256k1(e) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Error generated from WIF key format.
|
/// Error generated from WIF key format.
|
||||||
|
@ -956,11 +956,11 @@ impl std::error::Error for FromWifError {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<base58::Error> for FromWifError {
|
impl From<base58::Error> for FromWifError {
|
||||||
fn from(e: base58::Error) -> FromWifError { Self::Base58(e) }
|
fn from(e: base58::Error) -> Self { Self::Base58(e) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<secp256k1::Error> for FromWifError {
|
impl From<secp256k1::Error> for FromWifError {
|
||||||
fn from(e: secp256k1::Error) -> FromWifError { Self::Secp256k1(e) }
|
fn from(e: secp256k1::Error) -> Self { Self::Secp256k1(e) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Error returned while constructing public key from string.
|
/// Error returned while constructing public key from string.
|
||||||
|
@ -1033,11 +1033,11 @@ impl std::error::Error for ParseCompressedPublicKeyError {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<secp256k1::Error> for ParseCompressedPublicKeyError {
|
impl From<secp256k1::Error> for ParseCompressedPublicKeyError {
|
||||||
fn from(e: secp256k1::Error) -> ParseCompressedPublicKeyError { Self::Secp256k1(e) }
|
fn from(e: secp256k1::Error) -> Self { Self::Secp256k1(e) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<hex::HexToArrayError> for ParseCompressedPublicKeyError {
|
impl From<hex::HexToArrayError> for ParseCompressedPublicKeyError {
|
||||||
fn from(e: hex::HexToArrayError) -> ParseCompressedPublicKeyError { Self::HexError(e) }
|
fn from(e: hex::HexToArrayError) -> Self { Self::HexError(e) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Segwit public keys must always be compressed.
|
/// Segwit public keys must always be compressed.
|
||||||
|
|
Loading…
Reference in New Issue