From 0a16382fa349e17e07576f7d056025fd09a332bd Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Mon, 23 Dec 2024 14:40:56 +1100 Subject: [PATCH] Rename rhs to weight In ops functions we typically use `rhs` but for the more unconventional `checked_*_by_*` functions lets use a more descriptive parameter name. This is an internal change but the api files are updated because the paramater names appear in the api text files. --- units/src/amount/unsigned.rs | 8 ++++---- units/src/fee_rate.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/units/src/amount/unsigned.rs b/units/src/amount/unsigned.rs index 49edb71be..e7b214189 100644 --- a/units/src/amount/unsigned.rs +++ b/units/src/amount/unsigned.rs @@ -369,8 +369,8 @@ impl Amount { /// ``` #[cfg(feature = "alloc")] #[must_use] - pub const fn checked_div_by_weight_ceil(self, rhs: Weight) -> Option { - let wu = rhs.to_wu(); + pub const fn checked_div_by_weight_ceil(self, weight: Weight) -> Option { + let wu = weight.to_wu(); // No `?` operator in const context. if let Some(sats) = self.0.checked_mul(1_000) { if let Some(wu_minus_one) = wu.checked_sub(1) { @@ -392,10 +392,10 @@ impl Amount { /// Returns [`None`] if overflow occurred. #[cfg(feature = "alloc")] #[must_use] - pub const fn checked_div_by_weight_floor(self, rhs: Weight) -> Option { + pub const fn checked_div_by_weight_floor(self, weight: Weight) -> Option { // No `?` operator in const context. match self.0.checked_mul(1_000) { - Some(res) => match res.checked_div(rhs.to_wu()) { + Some(res) => match res.checked_div(weight.to_wu()) { Some(fee_rate) => Some(FeeRate::from_sat_per_kwu(fee_rate)), None => None, }, diff --git a/units/src/fee_rate.rs b/units/src/fee_rate.rs index 3429aa44a..8c9b79d3d 100644 --- a/units/src/fee_rate.rs +++ b/units/src/fee_rate.rs @@ -108,9 +108,9 @@ impl FeeRate { /// /// [`None`] is returned if an overflow occurred. #[must_use] - pub const fn checked_mul_by_weight(self, rhs: Weight) -> Option { + pub const fn checked_mul_by_weight(self, weight: Weight) -> Option { // No `?` operator in const context. - match self.0.checked_mul(rhs.to_wu()) { + match self.0.checked_mul(weight.to_wu()) { Some(mul_res) => match mul_res.checked_add(999) { Some(add_res) => Some(Amount::from_sat(add_res / 1000)), None => None,