Skip to content

Commit 1c3dee4

Browse files
committed
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.
1 parent 7ef7eef commit 1c3dee4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/util/amount.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,9 +1622,9 @@ mod tests {
16221622
assert_eq!(p("1.1", btc), Ok(Amount::from_sat(1_100_000_00)));
16231623
assert_eq!(p("100", sat), Ok(Amount::from_sat(100)));
16241624
assert_eq!(p("55", sat), Ok(Amount::from_sat(55)));
1625-
assert_eq!(p("5500000000000000000", sat), Ok(Amount::from_sat(5_500_000_000_000_000_000)));
1625+
assert_eq!(p("5500000000000000000", sat), Ok(Amount::from_sat(55_000_000_000_000_000_00)));
16261626
// Should this even pass?
1627-
assert_eq!(p("5500000000000000000.", sat), Ok(Amount::from_sat(5_500_000_000_000_000_000)));
1627+
assert_eq!(p("5500000000000000000.", sat), Ok(Amount::from_sat(55_000_000_000_000_000_00)));
16281628
assert_eq!(
16291629
p("12345678901.12345678", btc),
16301630
Ok(Amount::from_sat(12_345_678_901__123_456_78))
@@ -2006,6 +2006,7 @@ mod tests {
20062006

20072007
#[cfg(feature = "serde")]
20082008
#[test]
2009+
#[allow(clippy::inconsistent_digit_grouping)] // Group to show 100,000,000 sats per bitcoin.
20092010
fn serde_as_btc() {
20102011
use serde_json;
20112012

@@ -2041,6 +2042,7 @@ mod tests {
20412042

20422043
#[cfg(feature = "serde")]
20432044
#[test]
2045+
#[allow(clippy::inconsistent_digit_grouping)] // Group to show 100,000,000 sats per bitcoin.
20442046
fn serde_as_btc_opt() {
20452047
use serde_json;
20462048

@@ -2054,8 +2056,8 @@ mod tests {
20542056
}
20552057

20562058
let with = T {
2057-
amt: Some(Amount::from_sat(2__500_000_00)),
2058-
samt: Some(SignedAmount::from_sat(-2__500_000_00)),
2059+
amt: Some(Amount::from_sat(2_500_000_00)),
2060+
samt: Some(SignedAmount::from_sat(-2_500_000_00)),
20592061
};
20602062
let without = T {
20612063
amt: None,
@@ -2085,6 +2087,7 @@ mod tests {
20852087

20862088
#[cfg(feature = "serde")]
20872089
#[test]
2090+
#[allow(clippy::inconsistent_digit_grouping)] // Group to show 100,000,000 sats per bitcoin.
20882091
fn serde_as_sat_opt() {
20892092
use serde_json;
20902093

@@ -2098,8 +2101,8 @@ mod tests {
20982101
}
20992102

21002103
let with = T {
2101-
amt: Some(Amount::from_sat(2__500_000_00)),
2102-
samt: Some(SignedAmount::from_sat(-2__500_000_00)),
2104+
amt: Some(Amount::from_sat(2_500_000_00)),
2105+
samt: Some(SignedAmount::from_sat(-2_500_000_00)),
21032106
};
21042107
let without = T {
21052108
amt: None,

0 commit comments

Comments
 (0)