Run the formatter

Manually run `just fmt` - no other changes.
This commit is contained in:
Tobin C. Harding 2025-01-20 08:37:36 +11:00
parent 67f3d498af
commit 8e16a48252
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
3 changed files with 8 additions and 31 deletions

View File

@ -112,10 +112,7 @@ fn bitcoin_genesis_tx(params: &Params) -> Transaction {
witness: Witness::default(),
});
ret.output.push(TxOut {
value: Amount::FIFTY_BTC,
script_pubkey: out_script,
});
ret.output.push(TxOut { value: Amount::FIFTY_BTC, script_pubkey: out_script });
// end
ret

View File

@ -22,10 +22,7 @@ fn sanity_check() {
let ssat = SignedAmount::from_sat;
assert_eq!(ssat(-100).abs(), ssat(100));
assert_eq!(
ssat(i64::MIN + 1).checked_abs().unwrap(),
ssat(i64::MAX)
);
assert_eq!(ssat(i64::MIN + 1).checked_abs().unwrap(), ssat(i64::MAX));
assert_eq!(ssat(-100).signum(), -1);
assert_eq!(ssat(0).signum(), 0);
assert_eq!(ssat(100).signum(), 1);
@ -36,14 +33,8 @@ fn sanity_check() {
#[cfg(feature = "alloc")]
{
assert_eq!(
Amount::from_float_in(0_f64, Denomination::Bitcoin).unwrap(),
sat(0)
);
assert_eq!(
Amount::from_float_in(2_f64, Denomination::Bitcoin).unwrap(),
sat(200_000_000)
);
assert_eq!(Amount::from_float_in(0_f64, Denomination::Bitcoin).unwrap(), sat(0));
assert_eq!(Amount::from_float_in(2_f64, Denomination::Bitcoin).unwrap(), sat(200_000_000));
assert!(Amount::from_float_in(-100_f64, Denomination::Bitcoin).is_err());
}
}
@ -185,14 +176,8 @@ fn unchecked_arithmetic() {
let sat = Amount::from_sat;
let ssat = SignedAmount::from_sat;
assert_eq!(
ssat(10).unchecked_add(ssat(20)),
ssat(30)
);
assert_eq!(
ssat(50).unchecked_sub(ssat(10)),
ssat(40)
);
assert_eq!(ssat(10).unchecked_add(ssat(20)), ssat(30));
assert_eq!(ssat(50).unchecked_sub(ssat(10)), ssat(40));
assert_eq!(sat(5).unchecked_add(sat(7)), sat(12));
assert_eq!(sat(10).unchecked_sub(sat(7)), sat(3));
}
@ -201,10 +186,7 @@ fn unchecked_arithmetic() {
fn positive_sub() {
let ssat = SignedAmount::from_sat;
assert_eq!(
ssat(10).positive_sub(ssat(7)).unwrap(),
ssat(3)
);
assert_eq!(ssat(10).positive_sub(ssat(7)).unwrap(), ssat(3));
assert!(ssat(-10).positive_sub(ssat(7)).is_none());
assert!(ssat(10).positive_sub(ssat(-7)).is_none());
assert!(ssat(10).positive_sub(ssat(11)).is_none());

View File

@ -188,9 +188,7 @@ impl ops::Div<FeeRate> for Amount {
/// This operation will panic if `fee_rate` is zero or the division results in overflow.
///
/// Note: This uses floor division. For ceiling division use [`Amount::checked_div_by_fee_rate_ceil`].
fn div(self, rhs: FeeRate) -> Self::Output {
self.checked_div_by_fee_rate_floor(rhs).unwrap()
}
fn div(self, rhs: FeeRate) -> Self::Output { self.checked_div_by_fee_rate_floor(rhs).unwrap() }
}
#[cfg(test)]