units: Remove expect from rustdoc example

We can just assert against an explicit `Some` value instead of using
`expect`.
This commit is contained in:
Tobin C. Harding 2025-04-08 13:42:53 +10:00
parent 7307c115e8
commit 53c6ae4d40
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 2 deletions

View File

@ -31,8 +31,8 @@ impl Amount {
/// # use bitcoin_units::{amount, Amount, FeeRate, Weight}; /// # use bitcoin_units::{amount, Amount, FeeRate, Weight};
/// let amount = Amount::from_sat(10)?; /// let amount = Amount::from_sat(10)?;
/// let weight = Weight::from_wu(300); /// let weight = Weight::from_wu(300);
/// let fee_rate = amount.checked_div_by_weight_ceil(weight).expect("Division by weight failed"); /// let fee_rate = amount.checked_div_by_weight_ceil(weight);
/// assert_eq!(fee_rate, FeeRate::from_sat_per_kwu(34)); /// assert_eq!(fee_rate, Some(FeeRate::from_sat_per_kwu(34)));
/// # Ok::<_, amount::OutOfRangeError>(()) /// # Ok::<_, amount::OutOfRangeError>(())
/// ``` /// ```
#[must_use] #[must_use]