Use custom digit grouping

clippy emits a bunch of:

 warning: digits grouped inconsistently by underscores

We have a custom grouping elsewhere in this file

  10_000_000_00 sats == 10 BTC

Fix up all instances of large sats amount to uniformly using this format
and add compiler directives where needed to shoosh clippy.
This commit is contained in:
Tobin C. Harding 2022-06-23 13:54:34 +10:00
parent acd551e644
commit fd4239f1d2
1 changed files with 9 additions and 6 deletions

View File

@ -1622,9 +1622,9 @@ mod tests {
assert_eq!(p("1.1", btc), Ok(Amount::from_sat(1_100_000_00))); assert_eq!(p("1.1", btc), Ok(Amount::from_sat(1_100_000_00)));
assert_eq!(p("100", sat), Ok(Amount::from_sat(100))); assert_eq!(p("100", sat), Ok(Amount::from_sat(100)));
assert_eq!(p("55", sat), Ok(Amount::from_sat(55))); assert_eq!(p("55", sat), Ok(Amount::from_sat(55)));
assert_eq!(p("5500000000000000000", sat), Ok(Amount::from_sat(5_500_000_000_000_000_000))); assert_eq!(p("5500000000000000000", sat), Ok(Amount::from_sat(55_000_000_000_000_000_00)));
// Should this even pass? // Should this even pass?
assert_eq!(p("5500000000000000000.", sat), Ok(Amount::from_sat(5_500_000_000_000_000_000))); assert_eq!(p("5500000000000000000.", sat), Ok(Amount::from_sat(55_000_000_000_000_000_00)));
assert_eq!( assert_eq!(
p("12345678901.12345678", btc), p("12345678901.12345678", btc),
Ok(Amount::from_sat(12_345_678_901__123_456_78)) Ok(Amount::from_sat(12_345_678_901__123_456_78))
@ -2006,6 +2006,7 @@ mod tests {
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[test] #[test]
#[allow(clippy::inconsistent_digit_grouping)] // Group to show 100,000,000 sats per bitcoin.
fn serde_as_btc() { fn serde_as_btc() {
use serde_json; use serde_json;
@ -2041,6 +2042,7 @@ mod tests {
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[test] #[test]
#[allow(clippy::inconsistent_digit_grouping)] // Group to show 100,000,000 sats per bitcoin.
fn serde_as_btc_opt() { fn serde_as_btc_opt() {
use serde_json; use serde_json;
@ -2054,8 +2056,8 @@ mod tests {
} }
let with = T { let with = T {
amt: Some(Amount::from_sat(2__500_000_00)), amt: Some(Amount::from_sat(2_500_000_00)),
samt: Some(SignedAmount::from_sat(-2__500_000_00)), samt: Some(SignedAmount::from_sat(-2_500_000_00)),
}; };
let without = T { let without = T {
amt: None, amt: None,
@ -2085,6 +2087,7 @@ mod tests {
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[test] #[test]
#[allow(clippy::inconsistent_digit_grouping)] // Group to show 100,000,000 sats per bitcoin.
fn serde_as_sat_opt() { fn serde_as_sat_opt() {
use serde_json; use serde_json;
@ -2098,8 +2101,8 @@ mod tests {
} }
let with = T { let with = T {
amt: Some(Amount::from_sat(2__500_000_00)), amt: Some(Amount::from_sat(2_500_000_00)),
samt: Some(SignedAmount::from_sat(-2__500_000_00)), samt: Some(SignedAmount::from_sat(-2_500_000_00)),
}; };
let without = T { let without = T {
amt: None, amt: None,