Merge rust-bitcoin/rust-bitcoin#4527: Automated nightly rustfmt (2025-05-18)

d9ec934251 2025-05-18 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:
  tcharding:
    ACK d9ec934251
  apoelstra:
    ACK d9ec93425102a014fc495d0918f40ff0f3629e2b; successfully ran local tests

Tree-SHA512: 9f1914af1375443e421ab5309ef8af0f64aa0b3dd03a4cde15b8315d1453f43f35533ae31a7295a83599e7e5ce081149c97f63bbab21e371d60b9401baecc941
This commit is contained in:
merge-script 2025-05-20 14:43:01 +00:00
commit fa52a31ace
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
8 changed files with 20 additions and 19 deletions

View File

@ -23,7 +23,9 @@ impl Builder {
/// Constructs a new empty script builder with at least the specified capacity.
#[inline]
pub fn with_capacity(capacity: usize) -> Self { Builder(ScriptBuf::with_capacity(capacity), None) }
pub fn with_capacity(capacity: usize) -> Self {
Builder(ScriptBuf::with_capacity(capacity), None)
}
/// Returns the length in bytes of the script.
pub fn len(&self) -> usize { self.0.len() }

View File

@ -16,6 +16,7 @@ use hashes::sha256d;
use internals::{compact_size, write_err, ToU64};
use io::{BufRead, Write};
use primitives::Sequence;
use units::NumOpResult;
use super::Weight;
use crate::consensus::{self, encode, Decodable, Encodable};
@ -27,7 +28,6 @@ use crate::script::{Script, ScriptBuf, ScriptExt as _, ScriptExtPriv as _};
use crate::sighash::{EcdsaSighashType, TapSighashType};
use crate::witness::Witness;
use crate::{Amount, FeeRate, SignedAmount};
use units::NumOpResult;
#[rustfmt::skip] // Keep public re-exports separate.
#[doc(inline)]
@ -786,10 +786,7 @@ pub fn effective_value(
) -> NumOpResult<SignedAmount> {
let weight = input_weight_prediction.total_weight();
fee_rate
.to_fee(weight)
.map(Amount::to_signed)
.and_then(|fee| value.to_signed() - fee) // Cannot overflow.
fee_rate.to_fee(weight).map(Amount::to_signed).and_then(|fee| value.to_signed() - fee) // Cannot overflow.
}
/// Predicts the weight of a to-be-constructed transaction.

View File

@ -165,7 +165,6 @@ impl fmt::Display for AddrV2ConversionError {
impl std::error::Error for AddrV2ConversionError {}
impl From<SocketAddr> for AddrV2 {
fn from(addr: SocketAddr) -> Self {
match addr {

View File

@ -191,9 +191,10 @@ impl<'a> Arbitrary<'a> for FeeRate {
#[cfg(test)]
mod tests {
use super::*;
use core::num::NonZeroU64;
use super::*;
#[test]
fn sanity_check() {
let fee_rate: u64 = u64::from(FeeRate::from_sat_per_kwu(100));

View File

@ -88,7 +88,6 @@ pub enum NumOpResult<T> {
}
impl<T> NumOpResult<T> {
/// Maps a `NumOpResult<T>` to `NumOpResult<U>` by applying a function to a
/// contained [`NumOpResult::Valid`] value, leaving a [`NumOpResult::Error`] value untouched.
///

View File

@ -293,9 +293,10 @@ impl<'a> Arbitrary<'a> for Weight {
#[cfg(test)]
mod tests {
use super::*;
use core::num::NonZeroU64;
use super::*;
const ONE: Weight = Weight::from_wu(1);
const TWO: Weight = Weight::from_wu(2);
const FOUR: Weight = Weight::from_wu(4);

View File

@ -7,7 +7,9 @@
use bincode::serialize;
use bitcoin_units::locktime::{absolute, relative};
use bitcoin_units::{amount, fee_rate, Amount, BlockHeight, BlockInterval, FeeRate, SignedAmount, Weight};
use bitcoin_units::{
amount, fee_rate, Amount, BlockHeight, BlockInterval, FeeRate, SignedAmount, Weight,
};
use serde::{Deserialize, Serialize};
/// A struct that includes all the types that implement or support `serde` traits.