File tree Expand file tree Collapse file tree 2 files changed +3
-13
lines changed
Expand file tree Collapse file tree 2 files changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -57,13 +57,6 @@ mod encapsulate {
5757 /// The minimum value of an amount.
5858 pub const MIN : Self = Self ( -21_000_000 * 100_000_000 ) ;
5959
60- /// Constructs a new [`SignedAmount`] with satoshi precision and the given number of satoshis.
61- ///
62- /// Caller to guarantee that `satoshi` is within valid range.
63- ///
64- /// See [`Self::MIN`] and [`Self::MAX`].
65- pub const fn from_sat_unchecked ( satoshi : i64 ) -> SignedAmount { SignedAmount ( satoshi) }
66-
6760 /// Constructs a new [`SignedAmount`] with satoshi precision and the given number of satoshis.
6861 ///
6962 /// Accepts an `i32` which is guaranteed to be in range for the type, but which can only
Original file line number Diff line number Diff line change @@ -57,11 +57,6 @@ mod encapsulate {
5757 /// The minimum value of an amount.
5858 pub const MIN : Self = Self ( 0 ) ;
5959
60- /// Constructs a new [`Amount`] with satoshi precision and the given number of satoshis.
61- ///
62- /// Caller to guarantee that `satoshi` is within valid range. See [`Self::MAX`].
63- pub const fn from_sat_unchecked ( satoshi : u64 ) -> Amount { Self ( satoshi) }
64-
6560 /// Constructs a new [`Amount`] with satoshi precision and the given number of satoshis.
6661 ///
6762 /// Accepts an `u32` which is guaranteed to be in range for the type, but which can only
@@ -398,8 +393,10 @@ impl Amount {
398393
399394 /// Converts to a signed amount.
400395 #[ rustfmt:: skip] // Moves code comments to the wrong line.
396+ #[ allow( clippy:: missing_panics_doc) ]
401397 pub fn to_signed ( self ) -> SignedAmount {
402- SignedAmount :: from_sat_unchecked ( self . to_sat ( ) as i64 ) // Cast ok, signed amount and amount share positive range.
398+ SignedAmount :: from_sat ( self . to_sat ( ) as i64 ) // Cast ok, signed amount and amount share positive range.
399+ . expect ( "range of Amount is within range of SignedAmount" )
403400 }
404401}
405402
You can’t perform that action at this time.
0 commit comments