From 940a244132aa28af20facc2a425fbd583a26d3e5 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 27 Dec 2024 11:36:20 +1100 Subject: [PATCH] Replace Amount::from_sat(0) with ZERO We have a const for zero amount, use it. Internal change only. --- units/src/amount/tests.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/units/src/amount/tests.rs b/units/src/amount/tests.rs index 19b32ffec..64ab1957f 100644 --- a/units/src/amount/tests.rs +++ b/units/src/amount/tests.rs @@ -25,7 +25,7 @@ fn from_str_zero() { let s = format!("{} {}", v, denom); match s.parse::() { Err(e) => panic!("failed to crate amount from {}: {:?}", s, e), - Ok(amount) => assert_eq!(amount, Amount::from_sat(0)), + Ok(amount) => assert_eq!(amount, Amount::ZERO), } } @@ -41,7 +41,7 @@ fn from_str_zero() { } match s.parse::() { Err(e) => panic!("failed to crate amount from {}: {:?}", s, e), - Ok(amount) => assert_eq!(amount, SignedAmount::from_sat(0)), + Ok(amount) => assert_eq!(amount, SignedAmount::ZERO), } } } @@ -873,8 +873,8 @@ fn serde_as_str_opt() { #[test] fn sum_amounts() { - assert_eq!(Amount::from_sat(0), [].iter().sum::()); - assert_eq!(SignedAmount::from_sat(0), [].iter().sum::()); + assert_eq!(Amount::ZERO, [].iter().sum::()); + assert_eq!(SignedAmount::ZERO, [].iter().sum::()); let amounts = [Amount::from_sat(42), Amount::from_sat(1337), Amount::from_sat(21)]; let sum = amounts.into_iter().sum::(); @@ -888,8 +888,8 @@ fn sum_amounts() { #[test] fn checked_sum_amounts() { - assert_eq!(Some(Amount::from_sat(0)), [].into_iter().checked_sum()); - assert_eq!(Some(SignedAmount::from_sat(0)), [].into_iter().checked_sum()); + assert_eq!(Some(Amount::ZERO), [].into_iter().checked_sum()); + assert_eq!(Some(SignedAmount::ZERO), [].into_iter().checked_sum()); let amounts = [Amount::from_sat(42), Amount::from_sat(1337), Amount::from_sat(21)]; let sum = amounts.into_iter().checked_sum();