Merge rust-bitcoin/rust-bitcoin#3595: Automated nightly rustfmt (2024-11-17)

500cd10802 2024-11-17 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 500cd10802acc00df3664d7e7a03de7ad0bfe36e; successfully ran local tests; much less offensive this week
  tcharding:
    ACK 500cd10802

Tree-SHA512: 5dbd91260684f257277c5d2706ce8a95a4bf7d8d1e285e8e71261df35425cc7f512688c11643c4ea585905b05cbdfa221fb99731429d46eb5e33c12ab1088307
This commit is contained in:
merge-script 2024-11-18 16:59:46 +00:00
commit c47a41a076
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
5 changed files with 13 additions and 20 deletions

View File

@ -1083,24 +1083,16 @@ pub mod test_utils {
use crate::pow::{Target, Work, U256}; use crate::pow::{Target, Work, U256};
/// Converts a `u64` to a [`Work`] /// Converts a `u64` to a [`Work`]
pub fn u64_to_work(u: u64) -> Work { pub fn u64_to_work(u: u64) -> Work { Work(U256::from(u)) }
Work(U256::from(u))
}
/// Converts a `u128` to a [`Work`] /// Converts a `u128` to a [`Work`]
pub fn u128_to_work(u: u128) -> Work { pub fn u128_to_work(u: u128) -> Work { Work(U256::from(u)) }
Work(U256::from(u))
}
/// Converts a `u32` to a [`Target`] /// Converts a `u32` to a [`Target`]
pub fn u32_to_target(u: u32) -> Target { pub fn u32_to_target(u: u32) -> Target { Target(U256::from(u)) }
Target(U256::from(u))
}
/// Converts a `u64` to a [`Target`] /// Converts a `u64` to a [`Target`]
pub fn u64_to_target(u: u64) -> Target { pub fn u64_to_target(u: u64) -> Target { Target(U256::from(u)) }
Target(U256::from(u))
}
} }
#[cfg(test)] #[cfg(test)]

View File

@ -53,6 +53,7 @@ pub use units::{
fee_rate::{self, FeeRate}, fee_rate::{self, FeeRate},
weight::{self, Weight}, weight::{self, Weight},
}; };
#[doc(inline)] #[doc(inline)]
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub use self::{ pub use self::{

View File

@ -11,8 +11,8 @@ use core::{default, fmt, ops};
use arbitrary::{Arbitrary, Unstructured}; use arbitrary::{Arbitrary, Unstructured};
use super::{ use super::{
parse_signed_to_satoshi, split_amount_and_denomination, Amount, Denomination, parse_signed_to_satoshi, split_amount_and_denomination, Amount, Denomination, Display,
Display, DisplayStyle, OutOfRangeError, ParseAmountError, ParseError, DisplayStyle, OutOfRangeError, ParseAmountError, ParseError,
}; };
/// A signed amount. /// A signed amount.

View File

@ -13,8 +13,8 @@ use ::serde::{Deserialize, Serialize};
use arbitrary::{Arbitrary, Unstructured}; use arbitrary::{Arbitrary, Unstructured};
use super::{ use super::{
parse_signed_to_satoshi, split_amount_and_denomination, Denomination, Display, parse_signed_to_satoshi, split_amount_and_denomination, Denomination, Display, DisplayStyle,
DisplayStyle, OutOfRangeError, ParseAmountError, ParseError, SignedAmount, OutOfRangeError, ParseAmountError, ParseError, SignedAmount,
}; };
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
use crate::{FeeRate, Weight}; use crate::{FeeRate, Weight};

View File

@ -110,7 +110,7 @@ impl Weight {
// No `map()` in const context. // No `map()` in const context.
match self.0.checked_add(rhs.0) { match self.0.checked_add(rhs.0) {
Some(wu) => Some(Weight::from_wu(wu)), Some(wu) => Some(Weight::from_wu(wu)),
None => None None => None,
} }
} }
@ -121,7 +121,7 @@ impl Weight {
// No `map()` in const context. // No `map()` in const context.
match self.0.checked_sub(rhs.0) { match self.0.checked_sub(rhs.0) {
Some(wu) => Some(Weight::from_wu(wu)), Some(wu) => Some(Weight::from_wu(wu)),
None => None None => None,
} }
} }
@ -132,7 +132,7 @@ impl Weight {
// No `map()` in const context. // No `map()` in const context.
match self.0.checked_mul(rhs) { match self.0.checked_mul(rhs) {
Some(wu) => Some(Weight::from_wu(wu)), Some(wu) => Some(Weight::from_wu(wu)),
None => None None => None,
} }
} }
@ -143,7 +143,7 @@ impl Weight {
// No `map()` in const context. // No `map()` in const context.
match self.0.checked_div(rhs) { match self.0.checked_div(rhs) {
Some(wu) => Some(Weight::from_wu(wu)), Some(wu) => Some(Weight::from_wu(wu)),
None => None None => None,
} }
} }
} }