Skip to content

Commit

Permalink
2025-01-26 automated rustfmt nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
Fmt Bot authored and github-actions[bot] committed Jan 26, 2025
1 parent 5504e06 commit e46d243
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 32 deletions.
5 changes: 1 addition & 4 deletions bitcoin/src/blockdata/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion primitives/src/locktime/absolute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ mod tests {

assert!(lock_time.is_satisfied_by(height, day_after));
assert!(!lock_time.is_satisfied_by(height, day_before));

}

#[test]
Expand Down
30 changes: 6 additions & 24 deletions units/src/amount/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
}
}
Expand Down Expand Up @@ -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));
}
Expand All @@ -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());
Expand Down
4 changes: 1 addition & 3 deletions units/src/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit e46d243

Please sign in to comment.