From 6c614d9320e542e19196753bddc5b124e0274176 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 19 Mar 2025 13:58:12 +1100 Subject: [PATCH] units: Fix panic message Recently I wrote a panic message that included the maximum value of an integer however I used the max of a 16 bit value for both signed and unsigned - this is incorrect. Use the correct values for `u16::MAX` and `i16::MAX`. --- units/src/amount/signed.rs | 2 +- units/src/amount/unsigned.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/units/src/amount/signed.rs b/units/src/amount/signed.rs index 7070adf77..8b152c2df 100644 --- a/units/src/amount/signed.rs +++ b/units/src/amount/signed.rs @@ -152,7 +152,7 @@ impl SignedAmount { match Self::from_sat(sats) { Ok(amount) => amount, - Err(_) => panic!("unreachable - 65536 BTC is within range"), + Err(_) => panic!("unreachable - 32,767 BTC is within range"), } } diff --git a/units/src/amount/unsigned.rs b/units/src/amount/unsigned.rs index 20bb6f82b..9504af2a0 100644 --- a/units/src/amount/unsigned.rs +++ b/units/src/amount/unsigned.rs @@ -152,7 +152,7 @@ impl Amount { match Self::from_sat(sats) { Ok(amount) => amount, - Err(_) => panic!("unreachable - 65536 BTC is within range"), + Err(_) => panic!("unreachable - 65,535 BTC is within range"), } }