diff --git a/units/src/amount/signed.rs b/units/src/amount/signed.rs index 069eceee0..cc16fb8ee 100644 --- a/units/src/amount/signed.rs +++ b/units/src/amount/signed.rs @@ -57,13 +57,6 @@ mod encapsulate { /// The minimum value of an amount. pub const MIN: Self = Self(-21_000_000 * 100_000_000); - /// Constructs a new [`SignedAmount`] with satoshi precision and the given number of satoshis. - /// - /// Caller to guarantee that `satoshi` is within valid range. - /// - /// See [`Self::MIN`] and [`Self::MAX`]. - pub const fn from_sat_unchecked(satoshi: i64) -> SignedAmount { SignedAmount(satoshi) } - /// Constructs a new [`SignedAmount`] with satoshi precision and the given number of satoshis. /// /// Accepts an `i32` which is guaranteed to be in range for the type, but which can only diff --git a/units/src/amount/unsigned.rs b/units/src/amount/unsigned.rs index d82c3f881..1ff3637b6 100644 --- a/units/src/amount/unsigned.rs +++ b/units/src/amount/unsigned.rs @@ -57,11 +57,6 @@ mod encapsulate { /// The minimum value of an amount. pub const MIN: Self = Self(0); - /// Constructs a new [`Amount`] with satoshi precision and the given number of satoshis. - /// - /// Caller to guarantee that `satoshi` is within valid range. See [`Self::MAX`]. - pub const fn from_sat_unchecked(satoshi: u64) -> Amount { Self(satoshi) } - /// Constructs a new [`Amount`] with satoshi precision and the given number of satoshis. /// /// Accepts an `u32` which is guaranteed to be in range for the type, but which can only @@ -398,8 +393,10 @@ impl Amount { /// Converts to a signed amount. #[rustfmt::skip] // Moves code comments to the wrong line. + #[allow(clippy::missing_panics_doc)] pub fn to_signed(self) -> SignedAmount { - SignedAmount::from_sat_unchecked(self.to_sat() as i64) // Cast ok, signed amount and amount share positive range. + SignedAmount::from_sat(self.to_sat() as i64) // Cast ok, signed amount and amount share positive range. + .expect("range of Amount is within range of SignedAmount") } }