Merge rust-bitcoin/rust-bitcoin#3771: Automated nightly rustfmt (2024-12-15)

18d904d647 2024-12-15 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 18d904d647d2f9792923279a17a9a33968d5b39b; successfully ran local tests

Tree-SHA512: ce0cf8334aeb0f2a6232e100b72fa579c5a5b1258a8bf7b7ebd5d7981592813e8ee5581dc2debe07bddbc7083d186d6566f07f44869ca6e26a9abff289af0858
This commit is contained in:
merge-script 2024-12-15 18:40:37 +00:00
commit 2face0e92e
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
4 changed files with 12 additions and 14 deletions

View File

@ -398,9 +398,7 @@ mod tests {
pub amount: Amount,
}
let orig = HasAmount {
amount: Amount::ONE_BTC,
};
let orig = HasAmount { amount: Amount::ONE_BTC };
let json = serde_json::to_string(&orig).expect("failed to ser");
let want = "{\"amount\":100000000}";
@ -419,9 +417,7 @@ mod tests {
pub amount: Amount,
}
let orig = HasAmount {
amount: Amount::ONE_BTC,
};
let orig = HasAmount { amount: Amount::ONE_BTC };
let json = serde_json::to_string(&orig).expect("failed to ser");
let want = "{\"amount\":1.0}";
@ -440,9 +436,7 @@ mod tests {
pub amount: Amount,
}
let orig = HasAmount {
amount: Amount::ONE_BTC,
};
let orig = HasAmount { amount: Amount::ONE_BTC };
let json = serde_json::to_string(&orig).expect("failed to ser");
let want = "{\"amount\":\"1\"}";

View File

@ -112,9 +112,9 @@ impl SignedAmount {
ParseAmountErrorInner::OutOfRange(OutOfRangeError::too_big(true)),
)),
(false, sat) => Ok(SignedAmount(sat as i64)),
(true, sat) if sat > SignedAmount::MIN.to_sat().unsigned_abs() => Err(ParseAmountError(
ParseAmountErrorInner::OutOfRange(OutOfRangeError::too_small()),
)),
(true, sat) if sat > SignedAmount::MIN.to_sat().unsigned_abs() => Err(
ParseAmountError(ParseAmountErrorInner::OutOfRange(OutOfRangeError::too_small())),
),
(true, sat) => Ok(SignedAmount(-(sat as i64))),
}
}

View File

@ -619,7 +619,8 @@ fn to_from_string_in() {
ua_str(&ua_sat(1_000_000_000_000).to_string_in(D::MilliBitcoin), D::MilliBitcoin),
Ok(ua_sat(1_000_000_000_000))
);
assert!(ua_str(&ua_sat(Amount::MAX.to_sat()).to_string_in(D::MilliBitcoin), D::MilliBitcoin).is_ok());
assert!(ua_str(&ua_sat(Amount::MAX.to_sat()).to_string_in(D::MilliBitcoin), D::MilliBitcoin)
.is_ok());
assert_eq!(sa_str(&sa_sat(-1).to_string_in(D::MicroBitcoin), D::MicroBitcoin), Ok(sa_sat(-1)));

View File

@ -52,7 +52,10 @@ impl AsRef<core::num::ParseIntError> for ParseIntError {
/// Not strictly necessary but serves as a lint - avoids weird behavior if someone accidentally
/// passes non-integer to the `parse()` function.
pub trait Integer: FromStr<Err = core::num::ParseIntError> + TryFrom<i8> + Sized + sealed::Sealed {}
pub trait Integer:
FromStr<Err = core::num::ParseIntError> + TryFrom<i8> + Sized + sealed::Sealed
{
}
macro_rules! impl_integer {
($($type:ty),* $(,)?) => {