Clean up error type from impls

Make the `From` impls conform to our convention.

Refactor only, no logic changes.
This commit is contained in:
Tobin C. Harding 2024-02-06 12:48:22 +11:00
parent 36aa627d83
commit 482c8cb7f8
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
2 changed files with 8 additions and 8 deletions

View File

@ -241,15 +241,15 @@ impl std::error::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 {
fn from(err: NonStandardSighashTypeError) -> Self { Error::SighashType(err) }
fn from(e: NonStandardSighashTypeError) -> Self { Self::SighashType(e) }
}
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)]

View File

@ -921,7 +921,7 @@ impl std::error::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.
@ -956,11 +956,11 @@ impl std::error::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 {
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.
@ -1033,11 +1033,11 @@ impl std::error::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 {
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.