Skip to content

Commit

Permalink
Merge rust-bitcoin#3595: Automated nightly rustfmt (2024-11-17)
Browse files Browse the repository at this point in the history
500cd10 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 500cd10; successfully ran local tests; much less offensive this week
  tcharding:
    ACK 500cd10

Tree-SHA512: 5dbd91260684f257277c5d2706ce8a95a4bf7d8d1e285e8e71261df35425cc7f512688c11643c4ea585905b05cbdfa221fb99731429d46eb5e33c12ab1088307
  • Loading branch information
apoelstra committed Nov 18, 2024
2 parents dbedac1 + 500cd10 commit c47a41a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 20 deletions.
16 changes: 4 additions & 12 deletions bitcoin/src/pow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1083,24 +1083,16 @@ pub mod test_utils {
use crate::pow::{Target, Work, U256};

/// Converts a `u64` to a [`Work`]
pub fn u64_to_work(u: u64) -> Work {
Work(U256::from(u))
}
pub fn u64_to_work(u: u64) -> Work { Work(U256::from(u)) }

/// Converts a `u128` to a [`Work`]
pub fn u128_to_work(u: u128) -> Work {
Work(U256::from(u))
}
pub fn u128_to_work(u: u128) -> Work { Work(U256::from(u)) }

/// Converts a `u32` to a [`Target`]
pub fn u32_to_target(u: u32) -> Target {
Target(U256::from(u))
}
pub fn u32_to_target(u: u32) -> Target { Target(U256::from(u)) }

/// Converts a `u64` to a [`Target`]
pub fn u64_to_target(u: u64) -> Target {
Target(U256::from(u))
}
pub fn u64_to_target(u: u64) -> Target { Target(U256::from(u)) }
}

#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub use units::{
fee_rate::{self, FeeRate},
weight::{self, Weight},
};

#[doc(inline)]
#[cfg(feature = "alloc")]
pub use self::{
Expand Down
4 changes: 2 additions & 2 deletions units/src/amount/signed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use core::{default, fmt, ops};
use arbitrary::{Arbitrary, Unstructured};

use super::{
parse_signed_to_satoshi, split_amount_and_denomination, Amount, Denomination,
Display, DisplayStyle, OutOfRangeError, ParseAmountError, ParseError,
parse_signed_to_satoshi, split_amount_and_denomination, Amount, Denomination, Display,
DisplayStyle, OutOfRangeError, ParseAmountError, ParseError,
};

/// A signed amount.
Expand Down
4 changes: 2 additions & 2 deletions units/src/amount/unsigned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use ::serde::{Deserialize, Serialize};
use arbitrary::{Arbitrary, Unstructured};

use super::{
parse_signed_to_satoshi, split_amount_and_denomination, Denomination, Display,
DisplayStyle, OutOfRangeError, ParseAmountError, ParseError, SignedAmount,
parse_signed_to_satoshi, split_amount_and_denomination, Denomination, Display, DisplayStyle,
OutOfRangeError, ParseAmountError, ParseError, SignedAmount,
};
#[cfg(feature = "alloc")]
use crate::{FeeRate, Weight};
Expand Down
8 changes: 4 additions & 4 deletions units/src/weight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl Weight {
// No `map()` in const context.
match self.0.checked_add(rhs.0) {
Some(wu) => Some(Weight::from_wu(wu)),
None => None
None => None,
}
}

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

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

Expand All @@ -143,7 +143,7 @@ impl Weight {
// No `map()` in const context.
match self.0.checked_div(rhs) {
Some(wu) => Some(Weight::from_wu(wu)),
None => None
None => None,
}
}
}
Expand Down

0 comments on commit c47a41a

Please sign in to comment.