diff --git a/bitcoin/src/crypto/ecdsa.rs b/bitcoin/src/crypto/ecdsa.rs index aaf8046a..fd5cb4ae 100644 --- a/bitcoin/src/crypto/ecdsa.rs +++ b/bitcoin/src/crypto/ecdsa.rs @@ -241,15 +241,15 @@ impl std::error::Error for Error { } impl From for Error { - fn from(e: secp256k1::Error) -> Error { Error::Secp256k1(e) } + fn from(e: secp256k1::Error) -> Self { Self::Secp256k1(e) } } impl From for Error { - fn from(err: NonStandardSighashTypeError) -> Self { Error::SighashType(err) } + fn from(e: NonStandardSighashTypeError) -> Self { Self::SighashType(e) } } impl From for Error { - fn from(err: hex::HexToBytesError) -> Self { Error::Hex(err) } + fn from(e: hex::HexToBytesError) -> Self { Self::Hex(e) } } #[cfg(test)] diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs index 364a946c..fd363813 100644 --- a/bitcoin/src/crypto/key.rs +++ b/bitcoin/src/crypto/key.rs @@ -921,7 +921,7 @@ impl std::error::Error for FromSliceError { } impl From 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 for FromWifError { - fn from(e: base58::Error) -> FromWifError { Self::Base58(e) } + fn from(e: base58::Error) -> Self { Self::Base58(e) } } impl From 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. @@ -1007,7 +1007,7 @@ pub enum ParseCompressedPublicKeyError { /// Secp256k1 Error. Secp256k1(secp256k1::Error), /// hex to array conversion error. - HexError(hex::HexToArrayError), + Hex(hex::HexToArrayError), } impl fmt::Display for ParseCompressedPublicKeyError { @@ -1015,7 +1015,7 @@ impl fmt::Display for ParseCompressedPublicKeyError { use ParseCompressedPublicKeyError::*; match self { Secp256k1(e) => write_err!(f, "secp256k1 error"; e), - HexError(e) => write_err!(f, "invalid hex"; e) + Hex(e) => write_err!(f, "invalid hex"; e) } } } @@ -1027,17 +1027,17 @@ impl std::error::Error for ParseCompressedPublicKeyError { match self { Secp256k1(e) => Some(e), - HexError(e) => Some(e), + Hex(e) => Some(e), } } } impl From for ParseCompressedPublicKeyError { - fn from(e: secp256k1::Error) -> ParseCompressedPublicKeyError { Self::Secp256k1(e) } + fn from(e: secp256k1::Error) -> Self { Self::Secp256k1(e) } } impl From for ParseCompressedPublicKeyError { - fn from(e: hex::HexToArrayError) -> ParseCompressedPublicKeyError { Self::HexError(e) } + fn from(e: hex::HexToArrayError) -> Self { Self::Hex(e) } } /// Segwit public keys must always be compressed.