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:
commit
2face0e92e
|
@ -398,9 +398,7 @@ mod tests {
|
||||||
pub amount: Amount,
|
pub amount: Amount,
|
||||||
}
|
}
|
||||||
|
|
||||||
let orig = HasAmount {
|
let orig = HasAmount { amount: Amount::ONE_BTC };
|
||||||
amount: Amount::ONE_BTC,
|
|
||||||
};
|
|
||||||
|
|
||||||
let json = serde_json::to_string(&orig).expect("failed to ser");
|
let json = serde_json::to_string(&orig).expect("failed to ser");
|
||||||
let want = "{\"amount\":100000000}";
|
let want = "{\"amount\":100000000}";
|
||||||
|
@ -419,9 +417,7 @@ mod tests {
|
||||||
pub amount: Amount,
|
pub amount: Amount,
|
||||||
}
|
}
|
||||||
|
|
||||||
let orig = HasAmount {
|
let orig = HasAmount { amount: Amount::ONE_BTC };
|
||||||
amount: Amount::ONE_BTC,
|
|
||||||
};
|
|
||||||
|
|
||||||
let json = serde_json::to_string(&orig).expect("failed to ser");
|
let json = serde_json::to_string(&orig).expect("failed to ser");
|
||||||
let want = "{\"amount\":1.0}";
|
let want = "{\"amount\":1.0}";
|
||||||
|
@ -440,9 +436,7 @@ mod tests {
|
||||||
pub amount: Amount,
|
pub amount: Amount,
|
||||||
}
|
}
|
||||||
|
|
||||||
let orig = HasAmount {
|
let orig = HasAmount { amount: Amount::ONE_BTC };
|
||||||
amount: Amount::ONE_BTC,
|
|
||||||
};
|
|
||||||
|
|
||||||
let json = serde_json::to_string(&orig).expect("failed to ser");
|
let json = serde_json::to_string(&orig).expect("failed to ser");
|
||||||
let want = "{\"amount\":\"1\"}";
|
let want = "{\"amount\":\"1\"}";
|
||||||
|
|
|
@ -112,9 +112,9 @@ impl SignedAmount {
|
||||||
ParseAmountErrorInner::OutOfRange(OutOfRangeError::too_big(true)),
|
ParseAmountErrorInner::OutOfRange(OutOfRangeError::too_big(true)),
|
||||||
)),
|
)),
|
||||||
(false, sat) => Ok(SignedAmount(sat as i64)),
|
(false, sat) => Ok(SignedAmount(sat as i64)),
|
||||||
(true, sat) if sat > SignedAmount::MIN.to_sat().unsigned_abs() => Err(ParseAmountError(
|
(true, sat) if sat > SignedAmount::MIN.to_sat().unsigned_abs() => Err(
|
||||||
ParseAmountErrorInner::OutOfRange(OutOfRangeError::too_small()),
|
ParseAmountError(ParseAmountErrorInner::OutOfRange(OutOfRangeError::too_small())),
|
||||||
)),
|
),
|
||||||
(true, sat) => Ok(SignedAmount(-(sat as i64))),
|
(true, sat) => Ok(SignedAmount(-(sat as i64))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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),
|
ua_str(&ua_sat(1_000_000_000_000).to_string_in(D::MilliBitcoin), D::MilliBitcoin),
|
||||||
Ok(ua_sat(1_000_000_000_000))
|
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)));
|
assert_eq!(sa_str(&sa_sat(-1).to_string_in(D::MicroBitcoin), D::MicroBitcoin), Ok(sa_sat(-1)));
|
||||||
|
|
||||||
|
|
|
@ -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
|
/// Not strictly necessary but serves as a lint - avoids weird behavior if someone accidentally
|
||||||
/// passes non-integer to the `parse()` function.
|
/// 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 {
|
macro_rules! impl_integer {
|
||||||
($($type:ty),* $(,)?) => {
|
($($type:ty),* $(,)?) => {
|
||||||
|
|
Loading…
Reference in New Issue