Skip to content

Commit

Permalink
Merge rust-bitcoin#3422: Automated nightly rustfmt (2024-09-29)
Browse files Browse the repository at this point in the history
a65d2a0 2024-09-29 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:
  apoelstra:
    ACK a65d2a0 successfully ran local tests

Tree-SHA512: 0c2dae3507adeaae39a9c0a377aa002fd303109229ed05d9dc13fcf36584b94f83adc5101c81360fac24b5ffc8b1f6b37b5e713a6532ecce7e20f55c00cb4813
  • Loading branch information
apoelstra committed Sep 29, 2024
2 parents 10f1968 + a65d2a0 commit 94cd722
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 29 deletions.
2 changes: 1 addition & 1 deletion bitcoin/src/crypto/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ impl<'a> Arbitrary<'a> for Signature {
signature_bytes[..32].copy_from_slice(&bytes);
signature_bytes[32..].copy_from_slice(&bytes);

Ok(Signature{
Ok(Signature {
signature: secp256k1::ecdsa::Signature::from_compact(&signature_bytes).unwrap(),
sighash_type: EcdsaSighashType::arbitrary(u)?,
})
Expand Down
4 changes: 2 additions & 2 deletions bitcoin/src/crypto/sighash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,7 @@ impl<'a> Arbitrary<'a> for EcdsaSighashType {
2 => Ok(EcdsaSighashType::Single),
3 => Ok(EcdsaSighashType::AllPlusAnyoneCanPay),
4 => Ok(EcdsaSighashType::NonePlusAnyoneCanPay),
_ => Ok(EcdsaSighashType::SinglePlusAnyoneCanPay)
_ => Ok(EcdsaSighashType::SinglePlusAnyoneCanPay),
}
}
}
Expand All @@ -1495,7 +1495,7 @@ impl<'a> Arbitrary<'a> for TapSighashType {
3 => Ok(TapSighashType::Single),
4 => Ok(TapSighashType::AllPlusAnyoneCanPay),
5 => Ok(TapSighashType::NonePlusAnyoneCanPay),
_ => Ok(TapSighashType::SinglePlusAnyoneCanPay)
_ => Ok(TapSighashType::SinglePlusAnyoneCanPay),
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions hashes/src/siphash24.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ pub struct HashEngine {
k0: u64,
k1: u64,
bytes_hashed: u64, // how many bytes we've processed
state: State, // hash State
tail: u64, // unprocessed bytes le
ntail: usize, // how many bytes in tail are valid
state: State, // hash State
tail: u64, // unprocessed bytes le
ntail: usize, // how many bytes in tail are valid
}

impl HashEngine {
Expand Down Expand Up @@ -134,7 +134,8 @@ impl crate::HashEngine for HashEngine {

if self.ntail != 0 {
needed = 8 - self.ntail;
self.tail |= unsafe { u8to64_le(msg, 0, cmp::min(bytes_hashed, needed)) } << (8 * self.ntail);
self.tail |=
unsafe { u8to64_le(msg, 0, cmp::min(bytes_hashed, needed)) } << (8 * self.ntail);
if bytes_hashed < needed {
self.ntail += bytes_hashed;
return;
Expand Down
4 changes: 2 additions & 2 deletions primitives/src/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ impl<'a> Arbitrary<'a> for Sequence {
5 => Ok(Sequence::from_consensus(relative::Height::MAX.to_consensus_u32())),
6 => Ok(Sequence::from_consensus(relative::Time::MIN.to_consensus_u32())),
7 => Ok(Sequence::from_consensus(relative::Time::MAX.to_consensus_u32())),
_ => Ok(Sequence(u.arbitrary()?))
_ => Ok(Sequence(u.arbitrary()?)),
}
}
}
Expand All @@ -272,7 +272,7 @@ impl<'a> Arbitrary<'a> for Sequence {
1 => Ok(Sequence::ZERO),
2 => Ok(Sequence::MIN_NO_RBF),
3 => Ok(Sequence::ENABLE_RBF_NO_LOCKTIME),
_ => Ok(Sequence(u.arbitrary()?))
_ => Ok(Sequence(u.arbitrary()?)),
}
}
}
2 changes: 1 addition & 1 deletion primitives/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl<'a> Arbitrary<'a> for Version {
match choice {
0 => Ok(Version::ONE),
1 => Ok(Version::TWO),
_ => Ok(Version(u.arbitrary()?))
_ => Ok(Version(u.arbitrary()?)),
}
}
}
Expand Down
26 changes: 7 additions & 19 deletions units/src/fee_rate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Implements `FeeRate` and assoctiated features.
use core::fmt;
use core::ops::{Add, Sub, Div, Mul, AddAssign, SubAssign};
use core::ops::{Add, AddAssign, Div, Mul, Sub, SubAssign};

#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
Expand Down Expand Up @@ -154,25 +154,19 @@ impl Add for FeeRate {
impl Add<FeeRate> for &FeeRate {
type Output = FeeRate;

fn add(self, other: FeeRate) -> <FeeRate as Add>::Output {
FeeRate(self.0 + other.0)
}
fn add(self, other: FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 + other.0) }
}

impl Add<&FeeRate> for FeeRate {
type Output = FeeRate;

fn add(self, other: &FeeRate) -> <FeeRate as Add>::Output {
FeeRate(self.0 + other.0)
}
fn add(self, other: &FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 + other.0) }
}

impl<'a, 'b> Add<&'a FeeRate> for &'b FeeRate {
type Output = FeeRate;

fn add(self, other: &'a FeeRate) -> <FeeRate as Add>::Output {
FeeRate(self.0 + other.0)
}
fn add(self, other: &'a FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 + other.0) }
}

impl Sub for FeeRate {
Expand All @@ -184,25 +178,19 @@ impl Sub for FeeRate {
impl Sub<FeeRate> for &FeeRate {
type Output = FeeRate;

fn sub(self, other: FeeRate) -> <FeeRate as Add>::Output {
FeeRate(self.0 - other.0)
}
fn sub(self, other: FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 - other.0) }
}

impl Sub<&FeeRate> for FeeRate {
type Output = FeeRate;

fn sub(self, other: &FeeRate) -> <FeeRate as Add>::Output {
FeeRate(self.0 - other.0)
}
fn sub(self, other: &FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 - other.0) }
}

impl<'a, 'b> Sub<&'a FeeRate> for &'b FeeRate {
type Output = FeeRate;

fn sub(self, other: &'a FeeRate) -> <FeeRate as Add>::Output {
FeeRate(self.0 - other.0)
}
fn sub(self, other: &'a FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 - other.0) }
}

/// Computes the ceiling so that the fee computation is conservative.
Expand Down

0 comments on commit 94cd722

Please sign in to comment.