From 18d904d647d2f9792923279a17a9a33968d5b39b Mon Sep 17 00:00:00 2001 From: Fmt Bot Date: Sun, 15 Dec 2024 01:35:28 +0000 Subject: [PATCH] 2024-12-15 automated rustfmt nightly --- units/src/amount/serde.rs | 12 +++--------- units/src/amount/signed.rs | 6 +++--- units/src/amount/tests.rs | 3 ++- units/src/parse.rs | 5 ++++- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/units/src/amount/serde.rs b/units/src/amount/serde.rs index 2caa8c74e..46fa2f92f 100644 --- a/units/src/amount/serde.rs +++ b/units/src/amount/serde.rs @@ -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\"}"; diff --git a/units/src/amount/signed.rs b/units/src/amount/signed.rs index d88905dba..ab934c2b0 100644 --- a/units/src/amount/signed.rs +++ b/units/src/amount/signed.rs @@ -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))), } } diff --git a/units/src/amount/tests.rs b/units/src/amount/tests.rs index ca2774750..baa120026 100644 --- a/units/src/amount/tests.rs +++ b/units/src/amount/tests.rs @@ -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))); diff --git a/units/src/parse.rs b/units/src/parse.rs index 5e88fce0a..3dc01f8b0 100644 --- a/units/src/parse.rs +++ b/units/src/parse.rs @@ -52,7 +52,10 @@ impl AsRef 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 + TryFrom + Sized + sealed::Sealed {} +pub trait Integer: + FromStr + TryFrom + Sized + sealed::Sealed +{ +} macro_rules! impl_integer { ($($type:ty),* $(,)?) => {