Skip to content

Commit c5b1b31

Browse files
committed
Merge rust-bitcoin#4320: units: Do trivial docs fixes
da69e63 units: Use 100 column width in rustdoc comments (Tobin C. Harding) 53c6ae4 units: Remove expect from rustdoc example (Tobin C. Harding) Pull request description: A couple of quick docs fixes while trying to polish `units`. ACKs for top commit: apoelstra: ACK da69e63; successfully ran local tests Tree-SHA512: acfbec90b0327850b882c5e1b1e7eaadbf0a09a30dcc46529386ea419ed74846a678a5980f5706f8d280f30ec6f6d06af2db8f0e1748523b15ad47a654caee4b
2 parents b4326f0 + da69e63 commit c5b1b31

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

units/src/fee.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ impl Amount {
3030
/// # use bitcoin_units::{amount, Amount, FeeRate, Weight};
3131
/// let amount = Amount::from_sat(10)?;
3232
/// let weight = Weight::from_wu(300);
33-
/// let fee_rate = amount.checked_div_by_weight_ceil(weight).expect("Division by weight failed");
34-
/// assert_eq!(fee_rate, FeeRate::from_sat_per_kwu(34));
33+
/// let fee_rate = amount.checked_div_by_weight_ceil(weight);
34+
/// assert_eq!(fee_rate, Some(FeeRate::from_sat_per_kwu(34)));
3535
/// # Ok::<_, amount::OutOfRangeError>(())
3636
/// ```
3737
#[must_use]
@@ -140,10 +140,9 @@ impl FeeRate {
140140

141141
/// Checked weight multiplication.
142142
///
143-
/// Computes the absolute fee amount for a given [`Weight`] at this fee rate.
144-
/// When the resulting fee is a non-integer amount, the amount is rounded up,
145-
/// ensuring that the transaction fee is enough instead of falling short if
146-
/// rounded down.
143+
/// Computes the absolute fee amount for a given [`Weight`] at this fee rate. When the resulting
144+
/// fee is a non-integer amount, the amount is rounded up, ensuring that the transaction fee is
145+
/// enough instead of falling short if rounded down.
147146
///
148147
/// Returns [`None`] if overflow occurred.
149148
#[must_use]
@@ -197,10 +196,9 @@ crate::internal_macros::impl_op_for_references! {
197196
impl Weight {
198197
/// Checked fee rate multiplication.
199198
///
200-
/// Computes the absolute fee amount for a given [`FeeRate`] at this weight.
201-
/// When the resulting fee is a non-integer amount, the amount is rounded up,
202-
/// ensuring that the transaction fee is enough instead of falling short if
203-
/// rounded down.
199+
/// Computes the absolute fee amount for a given [`FeeRate`] at this weight. When the resulting
200+
/// fee is a non-integer amount, the amount is rounded up, ensuring that the transaction fee is
201+
/// enough instead of falling short if rounded down.
204202
///
205203
/// Returns [`None`] if overflow occurred.
206204
#[must_use]

units/src/fee_rate/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use arbitrary::{Arbitrary, Unstructured};
1212

1313
/// Represents fee rate.
1414
///
15-
/// This is an integer newtype representing fee rate in `sat/kwu`. It provides protection against mixing
16-
/// up the types as well as basic formatting features.
15+
/// This is an integer newtype representing fee rate in `sat/kwu`. It provides protection against
16+
/// mixing up the types as well as basic formatting features.
1717
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1818
pub struct FeeRate(u64);
1919

0 commit comments

Comments
 (0)