Merge rust-bitcoin/rust-bitcoin#2271: Automated nightly rustfmt (2023-12-10)

8e7afe5d4a 2023-12-10 automated rustfmt nightly (Fmt Bot)

Pull request description:

  Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  Kixunil:
    ACK 8e7afe5d4a
  apoelstra:
    ACK 8e7afe5d4a

Tree-SHA512: a389095f2d655cd0b4b7c82318a28c8e0e317972d06a973130e55a18b71577af61c2bbf688f0934008053fef79817b69f1d7d6055a9ca74c1722e2e8d5fa0144
This commit is contained in:
Andrew Poelstra 2023-12-10 13:57:39 +00:00
commit 07e342e647
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
3 changed files with 10 additions and 22 deletions

View File

@ -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))]

View File

@ -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<SerializedSignature> for [u8] {
}
impl core::hash::Hash for SerializedSignature {
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
(**self).hash(state)
}
fn hash<H: core::hash::Hasher>(&self, state: &mut H) { (**self).hash(state) }
}
impl AsRef<[u8]> for SerializedSignature {
@ -117,23 +112,17 @@ impl<'a> IntoIterator for &'a SerializedSignature {
}
impl From<Signature> 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<SerializedSignature> for Signature {
type Error = SigFromSliceError;
fn try_from(value: SerializedSignature) -> Result<Self, Self::Error> {
value.to_signature()
}
fn try_from(value: SerializedSignature) -> Result<Self, Self::Error> { 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, SigFromSliceError> { Signature::from_slice(self) }
pub fn to_signature(&self) -> Result<Signature, SigFromSliceError> {
Signature::from_slice(self)
}
/// Create a SerializedSignature from a Signature.
/// (this serializes it)

View File

@ -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<ErrorKind> for Error {