diff --git a/bitcoin/src/crypto/taproot.rs b/bitcoin/src/crypto/taproot.rs index e09acbea..ca771c8c 100644 --- a/bitcoin/src/crypto/taproot.rs +++ b/bitcoin/src/crypto/taproot.rs @@ -13,7 +13,6 @@ use crate::prelude::*; use crate::sighash::{InvalidSighashTypeError, TapSighashType}; use crate::taproot::serialized_signature::{self, SerializedSignature}; - /// A BIP340-341 serialized taproot signature with the corresponding hash type. #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] diff --git a/bitcoin/src/taproot/serialized_signature.rs b/bitcoin/src/taproot/serialized_signature.rs index b681e335..845847e8 100644 --- a/bitcoin/src/taproot/serialized_signature.rs +++ b/bitcoin/src/taproot/serialized_signature.rs @@ -11,8 +11,7 @@ use core::{fmt, ops}; pub use into_iter::IntoIter; -use super::Signature; -use super::SigFromSliceError; +use super::{SigFromSliceError, Signature}; pub(crate) const MAX_LEN: usize = 65; // 64 for sig, 1B sighash flag @@ -58,9 +57,7 @@ impl PartialOrd for SerializedSignature { } impl Ord for SerializedSignature { - fn cmp(&self, other: &SerializedSignature) -> core::cmp::Ordering { - (**self).cmp(&**other) - } + fn cmp(&self, other: &SerializedSignature) -> core::cmp::Ordering { (**self).cmp(&**other) } } impl PartialOrd<[u8]> for SerializedSignature { @@ -76,9 +73,7 @@ impl PartialOrd for [u8] { } impl core::hash::Hash for SerializedSignature { - fn hash(&self, state: &mut H) { - (**self).hash(state) - } + fn hash(&self, state: &mut H) { (**self).hash(state) } } impl AsRef<[u8]> for SerializedSignature { @@ -117,23 +112,17 @@ impl<'a> IntoIterator for &'a SerializedSignature { } impl From for SerializedSignature { - fn from(value: Signature) -> Self { - Self::from_signature(&value) - } + fn from(value: Signature) -> Self { Self::from_signature(&value) } } impl<'a> From<&'a Signature> for SerializedSignature { - fn from(value: &'a Signature) -> Self { - Self::from_signature(value) - } + fn from(value: &'a Signature) -> Self { Self::from_signature(value) } } impl TryFrom for Signature { type Error = SigFromSliceError; - fn try_from(value: SerializedSignature) -> Result { - value.to_signature() - } + fn try_from(value: SerializedSignature) -> Result { value.to_signature() } } impl<'a> TryFrom<&'a SerializedSignature> for Signature { @@ -169,7 +158,9 @@ impl SerializedSignature { /// Convert the serialized signature into the Signature struct. /// (This deserializes it) #[inline] - pub fn to_signature(&self) -> Result { Signature::from_slice(self) } + pub fn to_signature(&self) -> Result { + Signature::from_slice(self) + } /// Create a SerializedSignature from a Signature. /// (this serializes it) diff --git a/io/src/error.rs b/io/src/error.rs index 8d0a894d..62fa7941 100644 --- a/io/src/error.rs +++ b/io/src/error.rs @@ -34,9 +34,7 @@ impl Error { } #[cfg(all(feature = "alloc", not(feature = "std")))] - pub fn get_ref(&self) -> Option<&(dyn Debug + Send + Sync + 'static)> { - self.error.as_deref() - } + pub fn get_ref(&self) -> Option<&(dyn Debug + Send + Sync + 'static)> { self.error.as_deref() } } impl From for Error {