What changed, and why it matters
This commit is a code-style cleanup in the rust-bitcoin library's units crate. It enables a Clippy lint called use_self and replaces explicit type names (like FeeRate, Weight, LockTime) with the shorthand Self inside impl blocks. These changes do not alter program behavior, fix no bugs, and have no security relevance.
No security action needed. Treat as a normal code-quality/linting change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch adds use_self = “warn” to units/Cargo.toml and mechanically refactors impl blocks across the units crate to use Self instead of explicit type names. The diff also updates generated API snapshot files (api/units/*.txt) to reflect the changed type signatures in rustdoc output. No logic, arithmetic, parsing, serialization, or validation behavior is changed. This is a pure maintainability/style commit.
Changed components
units/Cargo.tomlunits/src/amount/error.rsunits/src/amount/mod.rsunits/src/amount/result.rsunits/src/amount/unsigned.rsunits/src/block.rsunits/src/fee_rate/mod.rsunits/src/locktime/absolute/error.rsunits/src/locktime/absolute/mod.rsunits/src/locktime/relative/error.rsunits/src/locktime/relative/mod.rsunits/src/parse_int.rsunits/src/result.rsunits/src/sequence.rsunits/src/time.rsunits/src/weight.rsunits/tests/api.rsapi/units/all-features.txtapi/units/alloc-only.txtapi/units/no-features.txtInspect captured patch +418 / −417
diff --git a/api/units/all-features.txt b/api/units/all-features.txt
index 86d3877e..e78fb377 100644
--- a/api/units/all-features.txt
+++ b/api/units/all-features.txt
@@ -1409,11 +1409,11 @@ pub const bitcoin_units::Amount::ONE_BTC: Self
pub const bitcoin_units::Amount::ONE_SAT: Self
pub const bitcoin_units::Amount::SIZE: usize
pub const bitcoin_units::Amount::ZERO: Self
-pub const bitcoin_units::FeeRate::BROADCAST_MIN: bitcoin_units::FeeRate
-pub const bitcoin_units::FeeRate::DUST: bitcoin_units::FeeRate
-pub const bitcoin_units::FeeRate::MAX: bitcoin_units::FeeRate
-pub const bitcoin_units::FeeRate::MIN: bitcoin_units::FeeRate
-pub const bitcoin_units::FeeRate::ZERO: bitcoin_units::FeeRate
+pub const bitcoin_units::FeeRate::BROADCAST_MIN: Self
+pub const bitcoin_units::FeeRate::DUST: Self
+pub const bitcoin_units::FeeRate::MAX: Self
+pub const bitcoin_units::FeeRate::MIN: Self
+pub const bitcoin_units::FeeRate::ZERO: Self
pub const bitcoin_units::SignedAmount::FIFTY_BTC: Self
pub const bitcoin_units::SignedAmount::MAX: Self
pub const bitcoin_units::SignedAmount::MAX_MONEY: Self
@@ -1421,12 +1421,12 @@ pub const bitcoin_units::SignedAmount::MIN: Self
pub const bitcoin_units::SignedAmount::ONE_BTC: Self
pub const bitcoin_units::SignedAmount::ONE_SAT: Self
pub const bitcoin_units::SignedAmount::ZERO: Self
-pub const bitcoin_units::Weight::MAX: bitcoin_units::Weight
-pub const bitcoin_units::Weight::MAX_BLOCK: bitcoin_units::Weight
-pub const bitcoin_units::Weight::MIN: bitcoin_units::Weight
-pub const bitcoin_units::Weight::MIN_TRANSACTION: bitcoin_units::Weight
+pub const bitcoin_units::Weight::MAX: Self
+pub const bitcoin_units::Weight::MAX_BLOCK: Self
+pub const bitcoin_units::Weight::MIN: Self
+pub const bitcoin_units::Weight::MIN_TRANSACTION: Self
pub const bitcoin_units::Weight::WITNESS_SCALE_FACTOR: u64
-pub const bitcoin_units::Weight::ZERO: bitcoin_units::Weight
+pub const bitcoin_units::Weight::ZERO: Self
pub const bitcoin_units::absolute::LOCK_TIME_THRESHOLD: u32
pub const bitcoin_units::amount::Denomination::BTC: Self
pub const bitcoin_units::amount::Denomination::SAT: Self
@@ -1447,11 +1447,11 @@ pub const bitcoin_units::locktime::absolute::Height::MIN: Self
pub const bitcoin_units::locktime::absolute::Height::ZERO: Self
pub const bitcoin_units::locktime::absolute::LOCK_TIME_THRESHOLD: u32
pub const bitcoin_units::locktime::absolute::LockTime::SIZE: usize
-pub const bitcoin_units::locktime::absolute::LockTime::ZERO: bitcoin_units::locktime::absolute::LockTime
+pub const bitcoin_units::locktime::absolute::LockTime::ZERO: Self
pub const bitcoin_units::locktime::absolute::MedianTimePast::MAX: Self
pub const bitcoin_units::locktime::absolute::MedianTimePast::MIN: Self
pub const bitcoin_units::locktime::relative::LockTime::SIZE: usize
-pub const bitcoin_units::locktime::relative::LockTime::ZERO: bitcoin_units::locktime::relative::LockTime
+pub const bitcoin_units::locktime::relative::LockTime::ZERO: Self
pub const bitcoin_units::locktime::relative::NumberOf512Seconds::MAX: Self
pub const bitcoin_units::locktime::relative::NumberOf512Seconds::MIN: Self
pub const bitcoin_units::locktime::relative::NumberOf512Seconds::ZERO: Self
@@ -1481,10 +1481,10 @@ pub const fn bitcoin_units::Amount::from_sat_u32(satoshi: u32) -> Self
pub const fn bitcoin_units::Amount::to_sat(self) -> u64
pub const fn bitcoin_units::BlockTime::from_u32(t: u32) -> Self
pub const fn bitcoin_units::BlockTime::to_u32(self) -> u32
-pub const fn bitcoin_units::FeeRate::checked_add(self, rhs: bitcoin_units::FeeRate) -> core::option::Option<Self>
+pub const fn bitcoin_units::FeeRate::checked_add(self, rhs: Self) -> core::option::Option<Self>
pub const fn bitcoin_units::FeeRate::checked_div(self, rhs: u64) -> core::option::Option<Self>
pub const fn bitcoin_units::FeeRate::checked_mul(self, rhs: u64) -> core::option::Option<Self>
-pub const fn bitcoin_units::FeeRate::checked_sub(self, rhs: bitcoin_units::FeeRate) -> core::option::Option<Self>
+pub const fn bitcoin_units::FeeRate::checked_sub(self, rhs: Self) -> core::option::Option<Self>
pub const fn bitcoin_units::FeeRate::from_per_kvb(rate: bitcoin_units::Amount) -> bitcoin_units::result::NumOpResult<Self>
pub const fn bitcoin_units::FeeRate::from_per_kwu(rate: bitcoin_units::Amount) -> bitcoin_units::result::NumOpResult<Self>
pub const fn bitcoin_units::FeeRate::from_per_vb(rate: bitcoin_units::Amount) -> bitcoin_units::result::NumOpResult<Self>
@@ -1518,7 +1518,7 @@ pub const fn bitcoin_units::Weight::from_kwu(wu: u64) -> core::option::Option<Se
pub const fn bitcoin_units::Weight::from_non_witness_data_size(non_witness_size: u64) -> Self
pub const fn bitcoin_units::Weight::from_vb(vb: u64) -> core::option::Option<Self>
pub const fn bitcoin_units::Weight::from_vb_unchecked(vb: u64) -> Self
-pub const fn bitcoin_units::Weight::from_vb_unwrap(vb: u64) -> bitcoin_units::Weight
+pub const fn bitcoin_units::Weight::from_vb_unwrap(vb: u64) -> Self
pub const fn bitcoin_units::Weight::from_witness_data_size(witness_size: u64) -> Self
pub const fn bitcoin_units::Weight::from_wu(wu: u64) -> Self
pub const fn bitcoin_units::Weight::mul_by_fee_rate(self, fee_rate: bitcoin_units::FeeRate) -> bitcoin_units::result::NumOpResult<bitcoin_units::Amount>
@@ -1539,11 +1539,11 @@ pub const fn bitcoin_units::block::BlockMtpInterval::from_u32(inner: u32) -> Sel
pub const fn bitcoin_units::block::BlockMtpInterval::to_relative_mtp_interval_ceil(self) -> core::result::Result<bitcoin_units::locktime::relative::NumberOf512Seconds, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub const fn bitcoin_units::block::BlockMtpInterval::to_relative_mtp_interval_floor(self) -> core::result::Result<bitcoin_units::locktime::relative::NumberOf512Seconds, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub const fn bitcoin_units::block::BlockMtpInterval::to_u32(self) -> u32
-pub const fn bitcoin_units::locktime::absolute::Height::from_u32(n: u32) -> core::result::Result<bitcoin_units::locktime::absolute::Height, bitcoin_units::locktime::absolute::error::ConversionError>
+pub const fn bitcoin_units::locktime::absolute::Height::from_u32(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
pub const fn bitcoin_units::locktime::absolute::Height::to_u32(self) -> u32
pub const fn bitcoin_units::locktime::absolute::LockTime::is_block_height(self) -> bool
pub const fn bitcoin_units::locktime::absolute::LockTime::is_block_time(self) -> bool
-pub const fn bitcoin_units::locktime::absolute::LockTime::is_same_unit(self, other: bitcoin_units::locktime::absolute::LockTime) -> bool
+pub const fn bitcoin_units::locktime::absolute::LockTime::is_same_unit(self, other: Self) -> bool
pub const fn bitcoin_units::locktime::absolute::MedianTimePast::from_u32(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
pub const fn bitcoin_units::locktime::absolute::MedianTimePast::to_u32(self) -> u32
pub const fn bitcoin_units::locktime::absolute::is_block_height(n: u32) -> bool
@@ -1554,7 +1554,7 @@ pub const fn bitcoin_units::locktime::relative::LockTime::from_seconds_ceil(seco
pub const fn bitcoin_units::locktime::relative::LockTime::from_seconds_floor(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub const fn bitcoin_units::locktime::relative::LockTime::is_block_height(self) -> bool
pub const fn bitcoin_units::locktime::relative::LockTime::is_block_time(self) -> bool
-pub const fn bitcoin_units::locktime::relative::LockTime::is_same_unit(self, other: bitcoin_units::locktime::relative::LockTime) -> bool
+pub const fn bitcoin_units::locktime::relative::LockTime::is_same_unit(self, other: Self) -> bool
pub const fn bitcoin_units::locktime::relative::NumberOf512Seconds::from_512_second_intervals(intervals: u16) -> Self
pub const fn bitcoin_units::locktime::relative::NumberOf512Seconds::from_seconds_ceil(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub const fn bitcoin_units::locktime::relative::NumberOf512Seconds::from_seconds_floor(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
@@ -1762,7 +1762,7 @@ pub fn bitcoin_units::Amount::mul(self, rhs: u64) -> Self::Output
pub fn bitcoin_units::Amount::partial_cmp(&self, other: &bitcoin_units::Amount) -> core::option::Option<core::cmp::Ordering>
pub fn bitcoin_units::Amount::rem(self, modulus: u64) -> Self::Output
pub fn bitcoin_units::Amount::rem(self, rhs: &u64) -> Self::Output
-pub fn bitcoin_units::Amount::signed_sub(self, rhs: bitcoin_units::Amount) -> bitcoin_units::SignedAmount
+pub fn bitcoin_units::Amount::signed_sub(self, rhs: Self) -> bitcoin_units::SignedAmount
pub fn bitcoin_units::Amount::sub(self, rhs: &bitcoin_units::Amount) -> Self::Output
pub fn bitcoin_units::Amount::sub(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::Amount>) -> Self::Output
pub fn bitcoin_units::Amount::sub(self, rhs: bitcoin_units::Amount) -> Self::Output
@@ -1808,7 +1808,7 @@ pub fn bitcoin_units::FeeRate::sub(self, rhs: &bitcoin_units::FeeRate) -> Self::
pub fn bitcoin_units::FeeRate::sub(self, rhs: bitcoin_units::FeeRate) -> Self::Output
pub fn bitcoin_units::FeeRate::sub_assign(&mut self, rhs: &bitcoin_units::FeeRate)
pub fn bitcoin_units::FeeRate::sub_assign(&mut self, rhs: bitcoin_units::FeeRate)
-pub fn bitcoin_units::FeeRate::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::FeeRate>
+pub fn bitcoin_units::FeeRate::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
pub fn bitcoin_units::FeeRate::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = Self>
pub fn bitcoin_units::SignedAmount::add(self, rhs: &bitcoin_units::SignedAmount) -> Self::Output
pub fn bitcoin_units::SignedAmount::add(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>) -> Self::Output
@@ -1893,7 +1893,7 @@ pub fn bitcoin_units::Weight::sub(self, rhs: &bitcoin_units::Weight) -> Self::Ou
pub fn bitcoin_units::Weight::sub(self, rhs: bitcoin_units::Weight) -> Self::Output
pub fn bitcoin_units::Weight::sub_assign(&mut self, rhs: &bitcoin_units::Weight)
pub fn bitcoin_units::Weight::sub_assign(&mut self, rhs: bitcoin_units::Weight)
-pub fn bitcoin_units::Weight::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::Weight>
+pub fn bitcoin_units::Weight::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
pub fn bitcoin_units::Weight::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = Self>
pub fn bitcoin_units::Weight::try_from(s: &str) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::Weight::try_from(s: alloc::boxed::Box<str>) -> core::result::Result<Self, Self::Error>
@@ -2048,7 +2048,7 @@ pub fn bitcoin_units::block::BlockHeightInterval::sub(self, rhs: bitcoin_units::
pub fn bitcoin_units::block::BlockHeightInterval::sub_assign(&mut self, rhs: &bitcoin_units::block::BlockHeightInterval)
pub fn bitcoin_units::block::BlockHeightInterval::sub_assign(&mut self, rhs: bitcoin_units::block::BlockHeightInterval)
pub fn bitcoin_units::block::BlockHeightInterval::sum<I: core::iter::traits::iterator::Iterator<Item = Self>>(iter: I) -> Self
-pub fn bitcoin_units::block::BlockHeightInterval::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::block::BlockHeightInterval>
+pub fn bitcoin_units::block::BlockHeightInterval::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
pub fn bitcoin_units::block::BlockHeightInterval::try_from(s: &str) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::block::BlockHeightInterval::try_from(s: alloc::boxed::Box<str>) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::block::BlockHeightInterval::try_from(s: alloc::string::String) -> core::result::Result<Self, Self::Error>
@@ -2100,7 +2100,7 @@ pub fn bitcoin_units::block::BlockMtpInterval::sub(self, rhs: bitcoin_units::blo
pub fn bitcoin_units::block::BlockMtpInterval::sub_assign(&mut self, rhs: &bitcoin_units::block::BlockMtpInterval)
pub fn bitcoin_units::block::BlockMtpInterval::sub_assign(&mut self, rhs: bitcoin_units::block::BlockMtpInterval)
pub fn bitcoin_units::block::BlockMtpInterval::sum<I: core::iter::traits::iterator::Iterator<Item = Self>>(iter: I) -> Self
-pub fn bitcoin_units::block::BlockMtpInterval::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::block::BlockMtpInterval>
+pub fn bitcoin_units::block::BlockMtpInterval::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
pub fn bitcoin_units::block::BlockMtpInterval::try_from(s: &str) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::block::BlockMtpInterval::try_from(s: alloc::boxed::Box<str>) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::block::BlockMtpInterval::try_from(s: alloc::string::String) -> core::result::Result<Self, Self::Error>
@@ -2131,7 +2131,7 @@ pub fn bitcoin_units::locktime::absolute::Height::fmt(&self, f: &mut core::fmt::
pub fn bitcoin_units::locktime::absolute::Height::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ParseHeightError>
pub fn bitcoin_units::locktime::absolute::Height::from_str(s: &str) -> core::result::Result<Self, Self::Err>
pub fn bitcoin_units::locktime::absolute::Height::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
-pub fn bitcoin_units::locktime::absolute::Height::is_satisfied_by(self, height: bitcoin_units::locktime::absolute::Height) -> bool
+pub fn bitcoin_units::locktime::absolute::Height::is_satisfied_by(self, height: Self) -> bool
pub fn bitcoin_units::locktime::absolute::Height::partial_cmp(&self, other: &bitcoin_units::locktime::absolute::Height) -> core::option::Option<core::cmp::Ordering>
pub fn bitcoin_units::locktime::absolute::Height::try_from(h: bitcoin_units::block::BlockHeight) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::locktime::absolute::Height::try_from(s: &str) -> core::result::Result<Self, Self::Error>
@@ -2153,7 +2153,7 @@ pub fn bitcoin_units::locktime::absolute::LockTime::from_mtp(n: u32) -> core::re
pub fn bitcoin_units::locktime::absolute::LockTime::from_str(s: &str) -> core::result::Result<Self, Self::Err>
pub fn bitcoin_units::locktime::absolute::LockTime::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::UnprefixedHexError>
pub fn bitcoin_units::locktime::absolute::LockTime::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
-pub fn bitcoin_units::locktime::absolute::LockTime::is_implied_by(self, other: bitcoin_units::locktime::absolute::LockTime) -> bool
+pub fn bitcoin_units::locktime::absolute::LockTime::is_implied_by(self, other: Self) -> bool
pub fn bitcoin_units::locktime::absolute::LockTime::is_satisfied_by(self, height: bitcoin_units::locktime::absolute::Height, mtp: bitcoin_units::locktime::absolute::MedianTimePast) -> bool
pub fn bitcoin_units::locktime::absolute::LockTime::is_satisfied_by_height(self, height: bitcoin_units::locktime::absolute::Height) -> core::result::Result<bool, bitcoin_units::locktime::absolute::error::IncompatibleHeightError>
pub fn bitcoin_units::locktime::absolute::LockTime::is_satisfied_by_time(self, mtp: bitcoin_units::locktime::absolute::MedianTimePast) -> core::result::Result<bool, bitcoin_units::locktime::absolute::error::IncompatibleTimeError>
@@ -2177,7 +2177,7 @@ pub fn bitcoin_units::locktime::absolute::MedianTimePast::fmt(&self, f: &mut cor
pub fn bitcoin_units::locktime::absolute::MedianTimePast::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ParseTimeError>
pub fn bitcoin_units::locktime::absolute::MedianTimePast::from_str(s: &str) -> core::result::Result<Self, Self::Err>
pub fn bitcoin_units::locktime::absolute::MedianTimePast::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
-pub fn bitcoin_units::locktime::absolute::MedianTimePast::is_satisfied_by(self, time: bitcoin_units::locktime::absolute::MedianTimePast) -> bool
+pub fn bitcoin_units::locktime::absolute::MedianTimePast::is_satisfied_by(self, time: Self) -> bool
pub fn bitcoin_units::locktime::absolute::MedianTimePast::new(timestamps: [bitcoin_units::BlockTime; 11]) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
pub fn bitcoin_units::locktime::absolute::MedianTimePast::partial_cmp(&self, other: &bitcoin_units::locktime::absolute::MedianTimePast) -> core::option::Option<core::cmp::Ordering>
pub fn bitcoin_units::locktime::absolute::MedianTimePast::try_from(h: bitcoin_units::block::BlockMtp) -> core::result::Result<Self, Self::Error>
@@ -2220,7 +2220,7 @@ pub fn bitcoin_units::locktime::relative::LockTime::from(t: bitcoin_units::lockt
pub fn bitcoin_units::locktime::relative::LockTime::from_consensus(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::DisabledLockTimeError>
pub fn bitcoin_units::locktime::relative::LockTime::from_sequence(n: bitcoin_units::sequence::Sequence) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::DisabledLockTimeError>
pub fn bitcoin_units::locktime::relative::LockTime::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
-pub fn bitcoin_units::locktime::relative::LockTime::is_implied_by(self, other: bitcoin_units::locktime::relative::LockTime) -> bool
+pub fn bitcoin_units::locktime::relative::LockTime::is_implied_by(self, other: Self) -> bool
pub fn bitcoin_units::locktime::relative::LockTime::is_implied_by_sequence(self, other: bitcoin_units::sequence::Sequence) -> bool
pub fn bitcoin_units::locktime::relative::LockTime::is_satisfied_by(self, chain_tip_height: bitcoin_units::block::BlockHeight, chain_tip_mtp: bitcoin_units::block::BlockMtp, utxo_mined_at_height: bitcoin_units::block::BlockHeight, utxo_mined_at_mtp: bitcoin_units::block::BlockMtp) -> core::result::Result<bool, bitcoin_units::locktime::relative::error::IsSatisfiedByError>
pub fn bitcoin_units::locktime::relative::LockTime::is_satisfied_by_height(self, chain_tip: bitcoin_units::block::BlockHeight, utxo_mined_at: bitcoin_units::block::BlockHeight) -> core::result::Result<bool, bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError>
@@ -2228,7 +2228,7 @@ pub fn bitcoin_units::locktime::relative::LockTime::is_satisfied_by_time(self, c
pub fn bitcoin_units::locktime::relative::LockTime::serialize<S>(&self, serializer: S) -> core::result::Result<<S as serde::ser::Serializer>::Ok, <S as serde::ser::Serializer>::Error> where S: serde::ser::Serializer
pub fn bitcoin_units::locktime::relative::LockTime::to_consensus_u32(self) -> u32
pub fn bitcoin_units::locktime::relative::LockTime::to_sequence(self) -> bitcoin_units::sequence::Sequence
-pub fn bitcoin_units::locktime::relative::LockTime::try_from(seq: bitcoin_units::sequence::Sequence) -> core::result::Result<bitcoin_units::locktime::relative::LockTime, bitcoin_units::locktime::relative::error::DisabledLockTimeError>
+pub fn bitcoin_units::locktime::relative::LockTime::try_from(seq: bitcoin_units::sequence::Sequence) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::DisabledLockTimeError>
pub fn bitcoin_units::locktime::relative::NumberOf512Seconds::arbitrary(u: &mut arbitrary::unstructured::Unstructured<'a>) -> arbitrary::error::Result<Self>
pub fn bitcoin_units::locktime::relative::NumberOf512Seconds::clone(&self) -> bitcoin_units::locktime::relative::NumberOf512Seconds
pub fn bitcoin_units::locktime::relative::NumberOf512Seconds::cmp(&self, other: &bitcoin_units::locktime::relative::NumberOf512Seconds) -> core::cmp::Ordering
@@ -2332,7 +2332,7 @@ pub fn bitcoin_units::result::NumOpResult<T>::add(self, rhs: &T) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<T>::add(self, rhs: &bitcoin_units::result::NumOpResult<T>) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<T>::add(self, rhs: Self) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<T>::add(self, rhs: T) -> Self::Output
-pub fn bitcoin_units::result::NumOpResult<T>::and_then<F>(self, op: F) -> bitcoin_units::result::NumOpResult<T> where F: core::ops::function::FnOnce(T) -> bitcoin_units::result::NumOpResult<T>
+pub fn bitcoin_units::result::NumOpResult<T>::and_then<F>(self, op: F) -> Self where F: core::ops::function::FnOnce(T) -> Self
pub fn bitcoin_units::result::NumOpResult<T>::arbitrary(u: &mut arbitrary::unstructured::Unstructured<'a>) -> arbitrary::error::Result<Self>
pub fn bitcoin_units::result::NumOpResult<T>::clone(&self) -> bitcoin_units::result::NumOpResult<T>
pub fn bitcoin_units::result::NumOpResult<T>::eq(&self, other: &bitcoin_units::result::NumOpResult<T>) -> bool
@@ -2371,8 +2371,8 @@ pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::mul_assign(&mu
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::mul_assign(&mut self, rhs: u64)
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::rem(self, modulus: u64) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::rem(self, rhs: &u64) -> Self::Output
-pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::result::NumOpResult<bitcoin_units::Amount>>
-pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = bitcoin_units::result::NumOpResult<bitcoin_units::Amount>>
+pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
+pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = Self>
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>::mul(self, rhs: &bitcoin_units::Weight) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>::mul(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::Weight>) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>::mul(self, rhs: bitcoin_units::Weight) -> Self::Output
@@ -2389,8 +2389,8 @@ pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::mul_assi
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::mul_assign(&mut self, rhs: i64)
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::rem(self, modulus: i64) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::rem(self, rhs: &i64) -> Self::Output
-pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>>
-pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>>
+pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
+pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = Self>
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::mul(self, rhs: &bitcoin_units::FeeRate) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::mul(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::mul(self, rhs: bitcoin_units::FeeRate) -> Self::Output
@@ -2405,7 +2405,7 @@ pub fn bitcoin_units::sequence::Sequence::enables_absolute_lock_time(self) -> bo
pub fn bitcoin_units::sequence::Sequence::encoder(&self) -> Self::Encoder
pub fn bitcoin_units::sequence::Sequence::eq(&self, other: &bitcoin_units::sequence::Sequence) -> bool
pub fn bitcoin_units::sequence::Sequence::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::sequence::Sequence::from(lt: bitcoin_units::locktime::relative::LockTime) -> bitcoin_units::sequence::Sequence
+pub fn bitcoin_units::sequence::Sequence::from(lt: bitcoin_units::locktime::relative::LockTime) -> Self
pub fn bitcoin_units::sequence::Sequence::from_512_second_intervals(intervals: u16) -> Self
pub fn bitcoin_units::sequence::Sequence::from_consensus(n: u32) -> Self
pub fn bitcoin_units::sequence::Sequence::from_height(height: u16) -> Self
@@ -2461,7 +2461,7 @@ pub fn u32::from(height: bitcoin_units::block::BlockHeight) -> Self
pub fn u32::from(height: bitcoin_units::block::BlockHeightInterval) -> Self
pub fn u32::from(height: bitcoin_units::block::BlockMtp) -> Self
pub fn u32::from(height: bitcoin_units::block::BlockMtpInterval) -> Self
-pub fn u32::from(sequence: bitcoin_units::sequence::Sequence) -> u32
+pub fn u32::from(sequence: bitcoin_units::sequence::Sequence) -> Self
pub fn u32::from(t: bitcoin_units::BlockTime) -> Self
pub fn u64::from(value: bitcoin_units::Weight) -> Self
pub fn u64::mul(self, rhs: &bitcoin_units::Amount) -> Self::Output
diff --git a/api/units/alloc-only.txt b/api/units/alloc-only.txt
index 3121d9c3..2a309184 100644
--- a/api/units/alloc-only.txt
+++ b/api/units/alloc-only.txt
@@ -1171,11 +1171,11 @@ pub const bitcoin_units::Amount::ONE_BTC: Self
pub const bitcoin_units::Amount::ONE_SAT: Self
pub const bitcoin_units::Amount::SIZE: usize
pub const bitcoin_units::Amount::ZERO: Self
-pub const bitcoin_units::FeeRate::BROADCAST_MIN: bitcoin_units::FeeRate
-pub const bitcoin_units::FeeRate::DUST: bitcoin_units::FeeRate
-pub const bitcoin_units::FeeRate::MAX: bitcoin_units::FeeRate
-pub const bitcoin_units::FeeRate::MIN: bitcoin_units::FeeRate
-pub const bitcoin_units::FeeRate::ZERO: bitcoin_units::FeeRate
+pub const bitcoin_units::FeeRate::BROADCAST_MIN: Self
+pub const bitcoin_units::FeeRate::DUST: Self
+pub const bitcoin_units::FeeRate::MAX: Self
+pub const bitcoin_units::FeeRate::MIN: Self
+pub const bitcoin_units::FeeRate::ZERO: Self
pub const bitcoin_units::SignedAmount::FIFTY_BTC: Self
pub const bitcoin_units::SignedAmount::MAX: Self
pub const bitcoin_units::SignedAmount::MAX_MONEY: Self
@@ -1183,12 +1183,12 @@ pub const bitcoin_units::SignedAmount::MIN: Self
pub const bitcoin_units::SignedAmount::ONE_BTC: Self
pub const bitcoin_units::SignedAmount::ONE_SAT: Self
pub const bitcoin_units::SignedAmount::ZERO: Self
-pub const bitcoin_units::Weight::MAX: bitcoin_units::Weight
-pub const bitcoin_units::Weight::MAX_BLOCK: bitcoin_units::Weight
-pub const bitcoin_units::Weight::MIN: bitcoin_units::Weight
-pub const bitcoin_units::Weight::MIN_TRANSACTION: bitcoin_units::Weight
+pub const bitcoin_units::Weight::MAX: Self
+pub const bitcoin_units::Weight::MAX_BLOCK: Self
+pub const bitcoin_units::Weight::MIN: Self
+pub const bitcoin_units::Weight::MIN_TRANSACTION: Self
pub const bitcoin_units::Weight::WITNESS_SCALE_FACTOR: u64
-pub const bitcoin_units::Weight::ZERO: bitcoin_units::Weight
+pub const bitcoin_units::Weight::ZERO: Self
pub const bitcoin_units::absolute::LOCK_TIME_THRESHOLD: u32
pub const bitcoin_units::amount::Denomination::BTC: Self
pub const bitcoin_units::amount::Denomination::SAT: Self
@@ -1209,11 +1209,11 @@ pub const bitcoin_units::locktime::absolute::Height::MIN: Self
pub const bitcoin_units::locktime::absolute::Height::ZERO: Self
pub const bitcoin_units::locktime::absolute::LOCK_TIME_THRESHOLD: u32
pub const bitcoin_units::locktime::absolute::LockTime::SIZE: usize
-pub const bitcoin_units::locktime::absolute::LockTime::ZERO: bitcoin_units::locktime::absolute::LockTime
+pub const bitcoin_units::locktime::absolute::LockTime::ZERO: Self
pub const bitcoin_units::locktime::absolute::MedianTimePast::MAX: Self
pub const bitcoin_units::locktime::absolute::MedianTimePast::MIN: Self
pub const bitcoin_units::locktime::relative::LockTime::SIZE: usize
-pub const bitcoin_units::locktime::relative::LockTime::ZERO: bitcoin_units::locktime::relative::LockTime
+pub const bitcoin_units::locktime::relative::LockTime::ZERO: Self
pub const bitcoin_units::locktime::relative::NumberOf512Seconds::MAX: Self
pub const bitcoin_units::locktime::relative::NumberOf512Seconds::MIN: Self
pub const bitcoin_units::locktime::relative::NumberOf512Seconds::ZERO: Self
@@ -1243,10 +1243,10 @@ pub const fn bitcoin_units::Amount::from_sat_u32(satoshi: u32) -> Self
pub const fn bitcoin_units::Amount::to_sat(self) -> u64
pub const fn bitcoin_units::BlockTime::from_u32(t: u32) -> Self
pub const fn bitcoin_units::BlockTime::to_u32(self) -> u32
-pub const fn bitcoin_units::FeeRate::checked_add(self, rhs: bitcoin_units::FeeRate) -> core::option::Option<Self>
+pub const fn bitcoin_units::FeeRate::checked_add(self, rhs: Self) -> core::option::Option<Self>
pub const fn bitcoin_units::FeeRate::checked_div(self, rhs: u64) -> core::option::Option<Self>
pub const fn bitcoin_units::FeeRate::checked_mul(self, rhs: u64) -> core::option::Option<Self>
-pub const fn bitcoin_units::FeeRate::checked_sub(self, rhs: bitcoin_units::FeeRate) -> core::option::Option<Self>
+pub const fn bitcoin_units::FeeRate::checked_sub(self, rhs: Self) -> core::option::Option<Self>
pub const fn bitcoin_units::FeeRate::from_per_kvb(rate: bitcoin_units::Amount) -> bitcoin_units::result::NumOpResult<Self>
pub const fn bitcoin_units::FeeRate::from_per_kwu(rate: bitcoin_units::Amount) -> bitcoin_units::result::NumOpResult<Self>
pub const fn bitcoin_units::FeeRate::from_per_vb(rate: bitcoin_units::Amount) -> bitcoin_units::result::NumOpResult<Self>
@@ -1280,7 +1280,7 @@ pub const fn bitcoin_units::Weight::from_kwu(wu: u64) -> core::option::Option<Se
pub const fn bitcoin_units::Weight::from_non_witness_data_size(non_witness_size: u64) -> Self
pub const fn bitcoin_units::Weight::from_vb(vb: u64) -> core::option::Option<Self>
pub const fn bitcoin_units::Weight::from_vb_unchecked(vb: u64) -> Self
-pub const fn bitcoin_units::Weight::from_vb_unwrap(vb: u64) -> bitcoin_units::Weight
+pub const fn bitcoin_units::Weight::from_vb_unwrap(vb: u64) -> Self
pub const fn bitcoin_units::Weight::from_witness_data_size(witness_size: u64) -> Self
pub const fn bitcoin_units::Weight::from_wu(wu: u64) -> Self
pub const fn bitcoin_units::Weight::mul_by_fee_rate(self, fee_rate: bitcoin_units::FeeRate) -> bitcoin_units::result::NumOpResult<bitcoin_units::Amount>
@@ -1301,11 +1301,11 @@ pub const fn bitcoin_units::block::BlockMtpInterval::from_u32(inner: u32) -> Sel
pub const fn bitcoin_units::block::BlockMtpInterval::to_relative_mtp_interval_ceil(self) -> core::result::Result<bitcoin_units::locktime::relative::NumberOf512Seconds, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub const fn bitcoin_units::block::BlockMtpInterval::to_relative_mtp_interval_floor(self) -> core::result::Result<bitcoin_units::locktime::relative::NumberOf512Seconds, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub const fn bitcoin_units::block::BlockMtpInterval::to_u32(self) -> u32
-pub const fn bitcoin_units::locktime::absolute::Height::from_u32(n: u32) -> core::result::Result<bitcoin_units::locktime::absolute::Height, bitcoin_units::locktime::absolute::error::ConversionError>
+pub const fn bitcoin_units::locktime::absolute::Height::from_u32(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
pub const fn bitcoin_units::locktime::absolute::Height::to_u32(self) -> u32
pub const fn bitcoin_units::locktime::absolute::LockTime::is_block_height(self) -> bool
pub const fn bitcoin_units::locktime::absolute::LockTime::is_block_time(self) -> bool
-pub const fn bitcoin_units::locktime::absolute::LockTime::is_same_unit(self, other: bitcoin_units::locktime::absolute::LockTime) -> bool
+pub const fn bitcoin_units::locktime::absolute::LockTime::is_same_unit(self, other: Self) -> bool
pub const fn bitcoin_units::locktime::absolute::MedianTimePast::from_u32(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
pub const fn bitcoin_units::locktime::absolute::MedianTimePast::to_u32(self) -> u32
pub const fn bitcoin_units::locktime::absolute::is_block_height(n: u32) -> bool
@@ -1316,7 +1316,7 @@ pub const fn bitcoin_units::locktime::relative::LockTime::from_seconds_ceil(seco
pub const fn bitcoin_units::locktime::relative::LockTime::from_seconds_floor(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub const fn bitcoin_units::locktime::relative::LockTime::is_block_height(self) -> bool
pub const fn bitcoin_units::locktime::relative::LockTime::is_block_time(self) -> bool
-pub const fn bitcoin_units::locktime::relative::LockTime::is_same_unit(self, other: bitcoin_units::locktime::relative::LockTime) -> bool
+pub const fn bitcoin_units::locktime::relative::LockTime::is_same_unit(self, other: Self) -> bool
pub const fn bitcoin_units::locktime::relative::NumberOf512Seconds::from_512_second_intervals(intervals: u16) -> Self
pub const fn bitcoin_units::locktime::relative::NumberOf512Seconds::from_seconds_ceil(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub const fn bitcoin_units::locktime::relative::NumberOf512Seconds::from_seconds_floor(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
@@ -1521,7 +1521,7 @@ pub fn bitcoin_units::Amount::mul(self, rhs: u64) -> Self::Output
pub fn bitcoin_units::Amount::partial_cmp(&self, other: &bitcoin_units::Amount) -> core::option::Option<core::cmp::Ordering>
pub fn bitcoin_units::Amount::rem(self, modulus: u64) -> Self::Output
pub fn bitcoin_units::Amount::rem(self, rhs: &u64) -> Self::Output
-pub fn bitcoin_units::Amount::signed_sub(self, rhs: bitcoin_units::Amount) -> bitcoin_units::SignedAmount
+pub fn bitcoin_units::Amount::signed_sub(self, rhs: Self) -> bitcoin_units::SignedAmount
pub fn bitcoin_units::Amount::sub(self, rhs: &bitcoin_units::Amount) -> Self::Output
pub fn bitcoin_units::Amount::sub(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::Amount>) -> Self::Output
pub fn bitcoin_units::Amount::sub(self, rhs: bitcoin_units::Amount) -> Self::Output
@@ -1561,7 +1561,7 @@ pub fn bitcoin_units::FeeRate::sub(self, rhs: &bitcoin_units::FeeRate) -> Self::
pub fn bitcoin_units::FeeRate::sub(self, rhs: bitcoin_units::FeeRate) -> Self::Output
pub fn bitcoin_units::FeeRate::sub_assign(&mut self, rhs: &bitcoin_units::FeeRate)
pub fn bitcoin_units::FeeRate::sub_assign(&mut self, rhs: bitcoin_units::FeeRate)
-pub fn bitcoin_units::FeeRate::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::FeeRate>
+pub fn bitcoin_units::FeeRate::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
pub fn bitcoin_units::FeeRate::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = Self>
pub fn bitcoin_units::SignedAmount::add(self, rhs: &bitcoin_units::SignedAmount) -> Self::Output
pub fn bitcoin_units::SignedAmount::add(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>) -> Self::Output
@@ -1642,7 +1642,7 @@ pub fn bitcoin_units::Weight::sub(self, rhs: &bitcoin_units::Weight) -> Self::Ou
pub fn bitcoin_units::Weight::sub(self, rhs: bitcoin_units::Weight) -> Self::Output
pub fn bitcoin_units::Weight::sub_assign(&mut self, rhs: &bitcoin_units::Weight)
pub fn bitcoin_units::Weight::sub_assign(&mut self, rhs: bitcoin_units::Weight)
-pub fn bitcoin_units::Weight::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::Weight>
+pub fn bitcoin_units::Weight::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
pub fn bitcoin_units::Weight::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = Self>
pub fn bitcoin_units::Weight::try_from(s: &str) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::Weight::try_from(s: alloc::boxed::Box<str>) -> core::result::Result<Self, Self::Error>
@@ -1747,7 +1747,7 @@ pub fn bitcoin_units::block::BlockHeightInterval::sub(self, rhs: bitcoin_units::
pub fn bitcoin_units::block::BlockHeightInterval::sub_assign(&mut self, rhs: &bitcoin_units::block::BlockHeightInterval)
pub fn bitcoin_units::block::BlockHeightInterval::sub_assign(&mut self, rhs: bitcoin_units::block::BlockHeightInterval)
pub fn bitcoin_units::block::BlockHeightInterval::sum<I: core::iter::traits::iterator::Iterator<Item = Self>>(iter: I) -> Self
-pub fn bitcoin_units::block::BlockHeightInterval::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::block::BlockHeightInterval>
+pub fn bitcoin_units::block::BlockHeightInterval::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
pub fn bitcoin_units::block::BlockHeightInterval::try_from(s: &str) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::block::BlockHeightInterval::try_from(s: alloc::boxed::Box<str>) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::block::BlockHeightInterval::try_from(s: alloc::string::String) -> core::result::Result<Self, Self::Error>
@@ -1793,7 +1793,7 @@ pub fn bitcoin_units::block::BlockMtpInterval::sub(self, rhs: bitcoin_units::blo
pub fn bitcoin_units::block::BlockMtpInterval::sub_assign(&mut self, rhs: &bitcoin_units::block::BlockMtpInterval)
pub fn bitcoin_units::block::BlockMtpInterval::sub_assign(&mut self, rhs: bitcoin_units::block::BlockMtpInterval)
pub fn bitcoin_units::block::BlockMtpInterval::sum<I: core::iter::traits::iterator::Iterator<Item = Self>>(iter: I) -> Self
-pub fn bitcoin_units::block::BlockMtpInterval::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::block::BlockMtpInterval>
+pub fn bitcoin_units::block::BlockMtpInterval::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
pub fn bitcoin_units::block::BlockMtpInterval::try_from(s: &str) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::block::BlockMtpInterval::try_from(s: alloc::boxed::Box<str>) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::block::BlockMtpInterval::try_from(s: alloc::string::String) -> core::result::Result<Self, Self::Error>
@@ -1807,7 +1807,7 @@ pub fn bitcoin_units::locktime::absolute::Height::fmt(&self, f: &mut core::fmt::
pub fn bitcoin_units::locktime::absolute::Height::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ParseHeightError>
pub fn bitcoin_units::locktime::absolute::Height::from_str(s: &str) -> core::result::Result<Self, Self::Err>
pub fn bitcoin_units::locktime::absolute::Height::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
-pub fn bitcoin_units::locktime::absolute::Height::is_satisfied_by(self, height: bitcoin_units::locktime::absolute::Height) -> bool
+pub fn bitcoin_units::locktime::absolute::Height::is_satisfied_by(self, height: Self) -> bool
pub fn bitcoin_units::locktime::absolute::Height::partial_cmp(&self, other: &bitcoin_units::locktime::absolute::Height) -> core::option::Option<core::cmp::Ordering>
pub fn bitcoin_units::locktime::absolute::Height::try_from(h: bitcoin_units::block::BlockHeight) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::locktime::absolute::Height::try_from(s: &str) -> core::result::Result<Self, Self::Error>
@@ -1825,7 +1825,7 @@ pub fn bitcoin_units::locktime::absolute::LockTime::from_mtp(n: u32) -> core::re
pub fn bitcoin_units::locktime::absolute::LockTime::from_str(s: &str) -> core::result::Result<Self, Self::Err>
pub fn bitcoin_units::locktime::absolute::LockTime::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::UnprefixedHexError>
pub fn bitcoin_units::locktime::absolute::LockTime::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
-pub fn bitcoin_units::locktime::absolute::LockTime::is_implied_by(self, other: bitcoin_units::locktime::absolute::LockTime) -> bool
+pub fn bitcoin_units::locktime::absolute::LockTime::is_implied_by(self, other: Self) -> bool
pub fn bitcoin_units::locktime::absolute::LockTime::is_satisfied_by(self, height: bitcoin_units::locktime::absolute::Height, mtp: bitcoin_units::locktime::absolute::MedianTimePast) -> bool
pub fn bitcoin_units::locktime::absolute::LockTime::is_satisfied_by_height(self, height: bitcoin_units::locktime::absolute::Height) -> core::result::Result<bool, bitcoin_units::locktime::absolute::error::IncompatibleHeightError>
pub fn bitcoin_units::locktime::absolute::LockTime::is_satisfied_by_time(self, mtp: bitcoin_units::locktime::absolute::MedianTimePast) -> core::result::Result<bool, bitcoin_units::locktime::absolute::error::IncompatibleTimeError>
@@ -1840,7 +1840,7 @@ pub fn bitcoin_units::locktime::absolute::MedianTimePast::fmt(&self, f: &mut cor
pub fn bitcoin_units::locktime::absolute::MedianTimePast::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ParseTimeError>
pub fn bitcoin_units::locktime::absolute::MedianTimePast::from_str(s: &str) -> core::result::Result<Self, Self::Err>
pub fn bitcoin_units::locktime::absolute::MedianTimePast::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
-pub fn bitcoin_units::locktime::absolute::MedianTimePast::is_satisfied_by(self, time: bitcoin_units::locktime::absolute::MedianTimePast) -> bool
+pub fn bitcoin_units::locktime::absolute::MedianTimePast::is_satisfied_by(self, time: Self) -> bool
pub fn bitcoin_units::locktime::absolute::MedianTimePast::new(timestamps: [bitcoin_units::BlockTime; 11]) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
pub fn bitcoin_units::locktime::absolute::MedianTimePast::partial_cmp(&self, other: &bitcoin_units::locktime::absolute::MedianTimePast) -> core::option::Option<core::cmp::Ordering>
pub fn bitcoin_units::locktime::absolute::MedianTimePast::try_from(h: bitcoin_units::block::BlockMtp) -> core::result::Result<Self, Self::Error>
@@ -1874,14 +1874,14 @@ pub fn bitcoin_units::locktime::relative::LockTime::from(t: bitcoin_units::lockt
pub fn bitcoin_units::locktime::relative::LockTime::from_consensus(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::DisabledLockTimeError>
pub fn bitcoin_units::locktime::relative::LockTime::from_sequence(n: bitcoin_units::sequence::Sequence) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::DisabledLockTimeError>
pub fn bitcoin_units::locktime::relative::LockTime::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
-pub fn bitcoin_units::locktime::relative::LockTime::is_implied_by(self, other: bitcoin_units::locktime::relative::LockTime) -> bool
+pub fn bitcoin_units::locktime::relative::LockTime::is_implied_by(self, other: Self) -> bool
pub fn bitcoin_units::locktime::relative::LockTime::is_implied_by_sequence(self, other: bitcoin_units::sequence::Sequence) -> bool
pub fn bitcoin_units::locktime::relative::LockTime::is_satisfied_by(self, chain_tip_height: bitcoin_units::block::BlockHeight, chain_tip_mtp: bitcoin_units::block::BlockMtp, utxo_mined_at_height: bitcoin_units::block::BlockHeight, utxo_mined_at_mtp: bitcoin_units::block::BlockMtp) -> core::result::Result<bool, bitcoin_units::locktime::relative::error::IsSatisfiedByError>
pub fn bitcoin_units::locktime::relative::LockTime::is_satisfied_by_height(self, chain_tip: bitcoin_units::block::BlockHeight, utxo_mined_at: bitcoin_units::block::BlockHeight) -> core::result::Result<bool, bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError>
pub fn bitcoin_units::locktime::relative::LockTime::is_satisfied_by_time(self, chain_tip: bitcoin_units::block::BlockMtp, utxo_mined_at: bitcoin_units::block::BlockMtp) -> core::result::Result<bool, bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError>
pub fn bitcoin_units::locktime::relative::LockTime::to_consensus_u32(self) -> u32
pub fn bitcoin_units::locktime::relative::LockTime::to_sequence(self) -> bitcoin_units::sequence::Sequence
-pub fn bitcoin_units::locktime::relative::LockTime::try_from(seq: bitcoin_units::sequence::Sequence) -> core::result::Result<bitcoin_units::locktime::relative::LockTime, bitcoin_units::locktime::relative::error::DisabledLockTimeError>
+pub fn bitcoin_units::locktime::relative::LockTime::try_from(seq: bitcoin_units::sequence::Sequence) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::DisabledLockTimeError>
pub fn bitcoin_units::locktime::relative::NumberOf512Seconds::clone(&self) -> bitcoin_units::locktime::relative::NumberOf512Seconds
pub fn bitcoin_units::locktime::relative::NumberOf512Seconds::cmp(&self, other: &bitcoin_units::locktime::relative::NumberOf512Seconds) -> core::cmp::Ordering
pub fn bitcoin_units::locktime::relative::NumberOf512Seconds::default() -> bitcoin_units::locktime::relative::NumberOf512Seconds
@@ -1976,7 +1976,7 @@ pub fn bitcoin_units::result::NumOpResult<T>::add(self, rhs: &T) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<T>::add(self, rhs: &bitcoin_units::result::NumOpResult<T>) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<T>::add(self, rhs: Self) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<T>::add(self, rhs: T) -> Self::Output
-pub fn bitcoin_units::result::NumOpResult<T>::and_then<F>(self, op: F) -> bitcoin_units::result::NumOpResult<T> where F: core::ops::function::FnOnce(T) -> bitcoin_units::result::NumOpResult<T>
+pub fn bitcoin_units::result::NumOpResult<T>::and_then<F>(self, op: F) -> Self where F: core::ops::function::FnOnce(T) -> Self
pub fn bitcoin_units::result::NumOpResult<T>::clone(&self) -> bitcoin_units::result::NumOpResult<T>
pub fn bitcoin_units::result::NumOpResult<T>::eq(&self, other: &bitcoin_units::result::NumOpResult<T>) -> bool
pub fn bitcoin_units::result::NumOpResult<T>::expect(self, msg: &str) -> T
@@ -2014,8 +2014,8 @@ pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::mul_assign(&mu
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::mul_assign(&mut self, rhs: u64)
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::rem(self, modulus: u64) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::rem(self, rhs: &u64) -> Self::Output
-pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::result::NumOpResult<bitcoin_units::Amount>>
-pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = bitcoin_units::result::NumOpResult<bitcoin_units::Amount>>
+pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
+pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = Self>
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>::mul(self, rhs: &bitcoin_units::Weight) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>::mul(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::Weight>) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>::mul(self, rhs: bitcoin_units::Weight) -> Self::Output
@@ -2032,8 +2032,8 @@ pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::mul_assi
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::mul_assign(&mut self, rhs: i64)
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::rem(self, modulus: i64) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::rem(self, rhs: &i64) -> Self::Output
-pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>>
-pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>>
+pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
+pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = Self>
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::mul(self, rhs: &bitcoin_units::FeeRate) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::mul(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::mul(self, rhs: bitcoin_units::FeeRate) -> Self::Output
@@ -2044,7 +2044,7 @@ pub fn bitcoin_units::sequence::Sequence::default() -> Self
pub fn bitcoin_units::sequence::Sequence::enables_absolute_lock_time(self) -> bool
pub fn bitcoin_units::sequence::Sequence::eq(&self, other: &bitcoin_units::sequence::Sequence) -> bool
pub fn bitcoin_units::sequence::Sequence::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::sequence::Sequence::from(lt: bitcoin_units::locktime::relative::LockTime) -> bitcoin_units::sequence::Sequence
+pub fn bitcoin_units::sequence::Sequence::from(lt: bitcoin_units::locktime::relative::LockTime) -> Self
pub fn bitcoin_units::sequence::Sequence::from_512_second_intervals(intervals: u16) -> Self
pub fn bitcoin_units::sequence::Sequence::from_consensus(n: u32) -> Self
pub fn bitcoin_units::sequence::Sequence::from_height(height: u16) -> Self
@@ -2075,7 +2075,7 @@ pub fn u32::from(height: bitcoin_units::block::BlockHeight) -> Self
pub fn u32::from(height: bitcoin_units::block::BlockHeightInterval) -> Self
pub fn u32::from(height: bitcoin_units::block::BlockMtp) -> Self
pub fn u32::from(height: bitcoin_units::block::BlockMtpInterval) -> Self
-pub fn u32::from(sequence: bitcoin_units::sequence::Sequence) -> u32
+pub fn u32::from(sequence: bitcoin_units::sequence::Sequence) -> Self
pub fn u32::from(t: bitcoin_units::BlockTime) -> Self
pub fn u64::from(value: bitcoin_units::Weight) -> Self
pub fn u64::mul(self, rhs: &bitcoin_units::Amount) -> Self::Output
diff --git a/api/units/no-features.txt b/api/units/no-features.txt
index 2933bf5a..356f2769 100644
--- a/api/units/no-features.txt
+++ b/api/units/no-features.txt
@@ -1147,11 +1147,11 @@ pub const bitcoin_units::Amount::ONE_BTC: Self
pub const bitcoin_units::Amount::ONE_SAT: Self
pub const bitcoin_units::Amount::SIZE: usize
pub const bitcoin_units::Amount::ZERO: Self
-pub const bitcoin_units::FeeRate::BROADCAST_MIN: bitcoin_units::FeeRate
-pub const bitcoin_units::FeeRate::DUST: bitcoin_units::FeeRate
-pub const bitcoin_units::FeeRate::MAX: bitcoin_units::FeeRate
-pub const bitcoin_units::FeeRate::MIN: bitcoin_units::FeeRate
-pub const bitcoin_units::FeeRate::ZERO: bitcoin_units::FeeRate
+pub const bitcoin_units::FeeRate::BROADCAST_MIN: Self
+pub const bitcoin_units::FeeRate::DUST: Self
+pub const bitcoin_units::FeeRate::MAX: Self
+pub const bitcoin_units::FeeRate::MIN: Self
+pub const bitcoin_units::FeeRate::ZERO: Self
pub const bitcoin_units::SignedAmount::FIFTY_BTC: Self
pub const bitcoin_units::SignedAmount::MAX: Self
pub const bitcoin_units::SignedAmount::MAX_MONEY: Self
@@ -1159,12 +1159,12 @@ pub const bitcoin_units::SignedAmount::MIN: Self
pub const bitcoin_units::SignedAmount::ONE_BTC: Self
pub const bitcoin_units::SignedAmount::ONE_SAT: Self
pub const bitcoin_units::SignedAmount::ZERO: Self
-pub const bitcoin_units::Weight::MAX: bitcoin_units::Weight
-pub const bitcoin_units::Weight::MAX_BLOCK: bitcoin_units::Weight
-pub const bitcoin_units::Weight::MIN: bitcoin_units::Weight
-pub const bitcoin_units::Weight::MIN_TRANSACTION: bitcoin_units::Weight
+pub const bitcoin_units::Weight::MAX: Self
+pub const bitcoin_units::Weight::MAX_BLOCK: Self
+pub const bitcoin_units::Weight::MIN: Self
+pub const bitcoin_units::Weight::MIN_TRANSACTION: Self
pub const bitcoin_units::Weight::WITNESS_SCALE_FACTOR: u64
-pub const bitcoin_units::Weight::ZERO: bitcoin_units::Weight
+pub const bitcoin_units::Weight::ZERO: Self
pub const bitcoin_units::absolute::LOCK_TIME_THRESHOLD: u32
pub const bitcoin_units::amount::Denomination::BTC: Self
pub const bitcoin_units::amount::Denomination::SAT: Self
@@ -1185,11 +1185,11 @@ pub const bitcoin_units::locktime::absolute::Height::MIN: Self
pub const bitcoin_units::locktime::absolute::Height::ZERO: Self
pub const bitcoin_units::locktime::absolute::LOCK_TIME_THRESHOLD: u32
pub const bitcoin_units::locktime::absolute::LockTime::SIZE: usize
-pub const bitcoin_units::locktime::absolute::LockTime::ZERO: bitcoin_units::locktime::absolute::LockTime
+pub const bitcoin_units::locktime::absolute::LockTime::ZERO: Self
pub const bitcoin_units::locktime::absolute::MedianTimePast::MAX: Self
pub const bitcoin_units::locktime::absolute::MedianTimePast::MIN: Self
pub const bitcoin_units::locktime::relative::LockTime::SIZE: usize
-pub const bitcoin_units::locktime::relative::LockTime::ZERO: bitcoin_units::locktime::relative::LockTime
+pub const bitcoin_units::locktime::relative::LockTime::ZERO: Self
pub const bitcoin_units::locktime::relative::NumberOf512Seconds::MAX: Self
pub const bitcoin_units::locktime::relative::NumberOf512Seconds::MIN: Self
pub const bitcoin_units::locktime::relative::NumberOf512Seconds::ZERO: Self
@@ -1219,10 +1219,10 @@ pub const fn bitcoin_units::Amount::from_sat_u32(satoshi: u32) -> Self
pub const fn bitcoin_units::Amount::to_sat(self) -> u64
pub const fn bitcoin_units::BlockTime::from_u32(t: u32) -> Self
pub const fn bitcoin_units::BlockTime::to_u32(self) -> u32
-pub const fn bitcoin_units::FeeRate::checked_add(self, rhs: bitcoin_units::FeeRate) -> core::option::Option<Self>
+pub const fn bitcoin_units::FeeRate::checked_add(self, rhs: Self) -> core::option::Option<Self>
pub const fn bitcoin_units::FeeRate::checked_div(self, rhs: u64) -> core::option::Option<Self>
pub const fn bitcoin_units::FeeRate::checked_mul(self, rhs: u64) -> core::option::Option<Self>
-pub const fn bitcoin_units::FeeRate::checked_sub(self, rhs: bitcoin_units::FeeRate) -> core::option::Option<Self>
+pub const fn bitcoin_units::FeeRate::checked_sub(self, rhs: Self) -> core::option::Option<Self>
pub const fn bitcoin_units::FeeRate::from_per_kvb(rate: bitcoin_units::Amount) -> bitcoin_units::result::NumOpResult<Self>
pub const fn bitcoin_units::FeeRate::from_per_kwu(rate: bitcoin_units::Amount) -> bitcoin_units::result::NumOpResult<Self>
pub const fn bitcoin_units::FeeRate::from_per_vb(rate: bitcoin_units::Amount) -> bitcoin_units::result::NumOpResult<Self>
@@ -1256,7 +1256,7 @@ pub const fn bitcoin_units::Weight::from_kwu(wu: u64) -> core::option::Option<Se
pub const fn bitcoin_units::Weight::from_non_witness_data_size(non_witness_size: u64) -> Self
pub const fn bitcoin_units::Weight::from_vb(vb: u64) -> core::option::Option<Self>
pub const fn bitcoin_units::Weight::from_vb_unchecked(vb: u64) -> Self
-pub const fn bitcoin_units::Weight::from_vb_unwrap(vb: u64) -> bitcoin_units::Weight
+pub const fn bitcoin_units::Weight::from_vb_unwrap(vb: u64) -> Self
pub const fn bitcoin_units::Weight::from_witness_data_size(witness_size: u64) -> Self
pub const fn bitcoin_units::Weight::from_wu(wu: u64) -> Self
pub const fn bitcoin_units::Weight::mul_by_fee_rate(self, fee_rate: bitcoin_units::FeeRate) -> bitcoin_units::result::NumOpResult<bitcoin_units::Amount>
@@ -1277,11 +1277,11 @@ pub const fn bitcoin_units::block::BlockMtpInterval::from_u32(inner: u32) -> Sel
pub const fn bitcoin_units::block::BlockMtpInterval::to_relative_mtp_interval_ceil(self) -> core::result::Result<bitcoin_units::locktime::relative::NumberOf512Seconds, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub const fn bitcoin_units::block::BlockMtpInterval::to_relative_mtp_interval_floor(self) -> core::result::Result<bitcoin_units::locktime::relative::NumberOf512Seconds, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub const fn bitcoin_units::block::BlockMtpInterval::to_u32(self) -> u32
-pub const fn bitcoin_units::locktime::absolute::Height::from_u32(n: u32) -> core::result::Result<bitcoin_units::locktime::absolute::Height, bitcoin_units::locktime::absolute::error::ConversionError>
+pub const fn bitcoin_units::locktime::absolute::Height::from_u32(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
pub const fn bitcoin_units::locktime::absolute::Height::to_u32(self) -> u32
pub const fn bitcoin_units::locktime::absolute::LockTime::is_block_height(self) -> bool
pub const fn bitcoin_units::locktime::absolute::LockTime::is_block_time(self) -> bool
-pub const fn bitcoin_units::locktime::absolute::LockTime::is_same_unit(self, other: bitcoin_units::locktime::absolute::LockTime) -> bool
+pub const fn bitcoin_units::locktime::absolute::LockTime::is_same_unit(self, other: Self) -> bool
pub const fn bitcoin_units::locktime::absolute::MedianTimePast::from_u32(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
pub const fn bitcoin_units::locktime::absolute::MedianTimePast::to_u32(self) -> u32
pub const fn bitcoin_units::locktime::absolute::is_block_height(n: u32) -> bool
@@ -1292,7 +1292,7 @@ pub const fn bitcoin_units::locktime::relative::LockTime::from_seconds_ceil(seco
pub const fn bitcoin_units::locktime::relative::LockTime::from_seconds_floor(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub const fn bitcoin_units::locktime::relative::LockTime::is_block_height(self) -> bool
pub const fn bitcoin_units::locktime::relative::LockTime::is_block_time(self) -> bool
-pub const fn bitcoin_units::locktime::relative::LockTime::is_same_unit(self, other: bitcoin_units::locktime::relative::LockTime) -> bool
+pub const fn bitcoin_units::locktime::relative::LockTime::is_same_unit(self, other: Self) -> bool
pub const fn bitcoin_units::locktime::relative::NumberOf512Seconds::from_512_second_intervals(intervals: u16) -> Self
pub const fn bitcoin_units::locktime::relative::NumberOf512Seconds::from_seconds_ceil(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub const fn bitcoin_units::locktime::relative::NumberOf512Seconds::from_seconds_floor(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
@@ -1495,7 +1495,7 @@ pub fn bitcoin_units::Amount::mul(self, rhs: u64) -> Self::Output
pub fn bitcoin_units::Amount::partial_cmp(&self, other: &bitcoin_units::Amount) -> core::option::Option<core::cmp::Ordering>
pub fn bitcoin_units::Amount::rem(self, modulus: u64) -> Self::Output
pub fn bitcoin_units::Amount::rem(self, rhs: &u64) -> Self::Output
-pub fn bitcoin_units::Amount::signed_sub(self, rhs: bitcoin_units::Amount) -> bitcoin_units::SignedAmount
+pub fn bitcoin_units::Amount::signed_sub(self, rhs: Self) -> bitcoin_units::SignedAmount
pub fn bitcoin_units::Amount::sub(self, rhs: &bitcoin_units::Amount) -> Self::Output
pub fn bitcoin_units::Amount::sub(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::Amount>) -> Self::Output
pub fn bitcoin_units::Amount::sub(self, rhs: bitcoin_units::Amount) -> Self::Output
@@ -1531,7 +1531,7 @@ pub fn bitcoin_units::FeeRate::sub(self, rhs: &bitcoin_units::FeeRate) -> Self::
pub fn bitcoin_units::FeeRate::sub(self, rhs: bitcoin_units::FeeRate) -> Self::Output
pub fn bitcoin_units::FeeRate::sub_assign(&mut self, rhs: &bitcoin_units::FeeRate)
pub fn bitcoin_units::FeeRate::sub_assign(&mut self, rhs: bitcoin_units::FeeRate)
-pub fn bitcoin_units::FeeRate::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::FeeRate>
+pub fn bitcoin_units::FeeRate::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
pub fn bitcoin_units::FeeRate::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = Self>
pub fn bitcoin_units::SignedAmount::add(self, rhs: &bitcoin_units::SignedAmount) -> Self::Output
pub fn bitcoin_units::SignedAmount::add(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>) -> Self::Output
@@ -1606,7 +1606,7 @@ pub fn bitcoin_units::Weight::sub(self, rhs: &bitcoin_units::Weight) -> Self::Ou
pub fn bitcoin_units::Weight::sub(self, rhs: bitcoin_units::Weight) -> Self::Output
pub fn bitcoin_units::Weight::sub_assign(&mut self, rhs: &bitcoin_units::Weight)
pub fn bitcoin_units::Weight::sub_assign(&mut self, rhs: bitcoin_units::Weight)
-pub fn bitcoin_units::Weight::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::Weight>
+pub fn bitcoin_units::Weight::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
pub fn bitcoin_units::Weight::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = Self>
pub fn bitcoin_units::Weight::try_from(s: &str) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::amount::Denomination::clone(&self) -> bitcoin_units::amount::Denomination
@@ -1707,7 +1707,7 @@ pub fn bitcoin_units::block::BlockHeightInterval::sub(self, rhs: bitcoin_units::
pub fn bitcoin_units::block::BlockHeightInterval::sub_assign(&mut self, rhs: &bitcoin_units::block::BlockHeightInterval)
pub fn bitcoin_units::block::BlockHeightInterval::sub_assign(&mut self, rhs: bitcoin_units::block::BlockHeightInterval)
pub fn bitcoin_units::block::BlockHeightInterval::sum<I: core::iter::traits::iterator::Iterator<Item = Self>>(iter: I) -> Self
-pub fn bitcoin_units::block::BlockHeightInterval::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::block::BlockHeightInterval>
+pub fn bitcoin_units::block::BlockHeightInterval::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
pub fn bitcoin_units::block::BlockHeightInterval::try_from(s: &str) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::block::BlockMtp::add(self, rhs: &bitcoin_units::block::BlockMtpInterval) -> Self::Output
pub fn bitcoin_units::block::BlockMtp::add(self, rhs: bitcoin_units::block::BlockMtpInterval) -> Self::Output
@@ -1749,7 +1749,7 @@ pub fn bitcoin_units::block::BlockMtpInterval::sub(self, rhs: bitcoin_units::blo
pub fn bitcoin_units::block::BlockMtpInterval::sub_assign(&mut self, rhs: &bitcoin_units::block::BlockMtpInterval)
pub fn bitcoin_units::block::BlockMtpInterval::sub_assign(&mut self, rhs: bitcoin_units::block::BlockMtpInterval)
pub fn bitcoin_units::block::BlockMtpInterval::sum<I: core::iter::traits::iterator::Iterator<Item = Self>>(iter: I) -> Self
-pub fn bitcoin_units::block::BlockMtpInterval::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::block::BlockMtpInterval>
+pub fn bitcoin_units::block::BlockMtpInterval::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
pub fn bitcoin_units::block::BlockMtpInterval::try_from(s: &str) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::block::TooBigForRelativeHeightError::clone(&self) -> bitcoin_units::block::TooBigForRelativeHeightError
pub fn bitcoin_units::block::TooBigForRelativeHeightError::eq(&self, other: &bitcoin_units::block::TooBigForRelativeHeightError) -> bool
@@ -1761,7 +1761,7 @@ pub fn bitcoin_units::locktime::absolute::Height::fmt(&self, f: &mut core::fmt::
pub fn bitcoin_units::locktime::absolute::Height::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ParseHeightError>
pub fn bitcoin_units::locktime::absolute::Height::from_str(s: &str) -> core::result::Result<Self, Self::Err>
pub fn bitcoin_units::locktime::absolute::Height::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
-pub fn bitcoin_units::locktime::absolute::Height::is_satisfied_by(self, height: bitcoin_units::locktime::absolute::Height) -> bool
+pub fn bitcoin_units::locktime::absolute::Height::is_satisfied_by(self, height: Self) -> bool
pub fn bitcoin_units::locktime::absolute::Height::partial_cmp(&self, other: &bitcoin_units::locktime::absolute::Height) -> core::option::Option<core::cmp::Ordering>
pub fn bitcoin_units::locktime::absolute::Height::try_from(h: bitcoin_units::block::BlockHeight) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::locktime::absolute::Height::try_from(s: &str) -> core::result::Result<Self, Self::Error>
@@ -1777,7 +1777,7 @@ pub fn bitcoin_units::locktime::absolute::LockTime::from_mtp(n: u32) -> core::re
pub fn bitcoin_units::locktime::absolute::LockTime::from_str(s: &str) -> core::result::Result<Self, Self::Err>
pub fn bitcoin_units::locktime::absolute::LockTime::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::UnprefixedHexError>
pub fn bitcoin_units::locktime::absolute::LockTime::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
-pub fn bitcoin_units::locktime::absolute::LockTime::is_implied_by(self, other: bitcoin_units::locktime::absolute::LockTime) -> bool
+pub fn bitcoin_units::locktime::absolute::LockTime::is_implied_by(self, other: Self) -> bool
pub fn bitcoin_units::locktime::absolute::LockTime::is_satisfied_by(self, height: bitcoin_units::locktime::absolute::Height, mtp: bitcoin_units::locktime::absolute::MedianTimePast) -> bool
pub fn bitcoin_units::locktime::absolute::LockTime::is_satisfied_by_height(self, height: bitcoin_units::locktime::absolute::Height) -> core::result::Result<bool, bitcoin_units::locktime::absolute::error::IncompatibleHeightError>
pub fn bitcoin_units::locktime::absolute::LockTime::is_satisfied_by_time(self, mtp: bitcoin_units::locktime::absolute::MedianTimePast) -> core::result::Result<bool, bitcoin_units::locktime::absolute::error::IncompatibleTimeError>
@@ -1790,7 +1790,7 @@ pub fn bitcoin_units::locktime::absolute::MedianTimePast::fmt(&self, f: &mut cor
pub fn bitcoin_units::locktime::absolute::MedianTimePast::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ParseTimeError>
pub fn bitcoin_units::locktime::absolute::MedianTimePast::from_str(s: &str) -> core::result::Result<Self, Self::Err>
pub fn bitcoin_units::locktime::absolute::MedianTimePast::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
-pub fn bitcoin_units::locktime::absolute::MedianTimePast::is_satisfied_by(self, time: bitcoin_units::locktime::absolute::MedianTimePast) -> bool
+pub fn bitcoin_units::locktime::absolute::MedianTimePast::is_satisfied_by(self, time: Self) -> bool
pub fn bitcoin_units::locktime::absolute::MedianTimePast::new(timestamps: [bitcoin_units::BlockTime; 11]) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
pub fn bitcoin_units::locktime::absolute::MedianTimePast::partial_cmp(&self, other: &bitcoin_units::locktime::absolute::MedianTimePast) -> core::option::Option<core::cmp::Ordering>
pub fn bitcoin_units::locktime::absolute::MedianTimePast::try_from(h: bitcoin_units::block::BlockMtp) -> core::result::Result<Self, Self::Error>
@@ -1822,14 +1822,14 @@ pub fn bitcoin_units::locktime::relative::LockTime::from(t: bitcoin_units::lockt
pub fn bitcoin_units::locktime::relative::LockTime::from_consensus(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::DisabledLockTimeError>
pub fn bitcoin_units::locktime::relative::LockTime::from_sequence(n: bitcoin_units::sequence::Sequence) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::DisabledLockTimeError>
pub fn bitcoin_units::locktime::relative::LockTime::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
-pub fn bitcoin_units::locktime::relative::LockTime::is_implied_by(self, other: bitcoin_units::locktime::relative::LockTime) -> bool
+pub fn bitcoin_units::locktime::relative::LockTime::is_implied_by(self, other: Self) -> bool
pub fn bitcoin_units::locktime::relative::LockTime::is_implied_by_sequence(self, other: bitcoin_units::sequence::Sequence) -> bool
pub fn bitcoin_units::locktime::relative::LockTime::is_satisfied_by(self, chain_tip_height: bitcoin_units::block::BlockHeight, chain_tip_mtp: bitcoin_units::block::BlockMtp, utxo_mined_at_height: bitcoin_units::block::BlockHeight, utxo_mined_at_mtp: bitcoin_units::block::BlockMtp) -> core::result::Result<bool, bitcoin_units::locktime::relative::error::IsSatisfiedByError>
pub fn bitcoin_units::locktime::relative::LockTime::is_satisfied_by_height(self, chain_tip: bitcoin_units::block::BlockHeight, utxo_mined_at: bitcoin_units::block::BlockHeight) -> core::result::Result<bool, bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError>
pub fn bitcoin_units::locktime::relative::LockTime::is_satisfied_by_time(self, chain_tip: bitcoin_units::block::BlockMtp, utxo_mined_at: bitcoin_units::block::BlockMtp) -> core::result::Result<bool, bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError>
pub fn bitcoin_units::locktime::relative::LockTime::to_consensus_u32(self) -> u32
pub fn bitcoin_units::locktime::relative::LockTime::to_sequence(self) -> bitcoin_units::sequence::Sequence
-pub fn bitcoin_units::locktime::relative::LockTime::try_from(seq: bitcoin_units::sequence::Sequence) -> core::result::Result<bitcoin_units::locktime::relative::LockTime, bitcoin_units::locktime::relative::error::DisabledLockTimeError>
+pub fn bitcoin_units::locktime::relative::LockTime::try_from(seq: bitcoin_units::sequence::Sequence) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::DisabledLockTimeError>
pub fn bitcoin_units::locktime::relative::NumberOf512Seconds::clone(&self) -> bitcoin_units::locktime::relative::NumberOf512Seconds
pub fn bitcoin_units::locktime::relative::NumberOf512Seconds::cmp(&self, other: &bitcoin_units::locktime::relative::NumberOf512Seconds) -> core::cmp::Ordering
pub fn bitcoin_units::locktime::relative::NumberOf512Seconds::default() -> bitcoin_units::locktime::relative::NumberOf512Seconds
@@ -1918,7 +1918,7 @@ pub fn bitcoin_units::result::NumOpResult<T>::add(self, rhs: &T) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<T>::add(self, rhs: &bitcoin_units::result::NumOpResult<T>) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<T>::add(self, rhs: Self) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<T>::add(self, rhs: T) -> Self::Output
-pub fn bitcoin_units::result::NumOpResult<T>::and_then<F>(self, op: F) -> bitcoin_units::result::NumOpResult<T> where F: core::ops::function::FnOnce(T) -> bitcoin_units::result::NumOpResult<T>
+pub fn bitcoin_units::result::NumOpResult<T>::and_then<F>(self, op: F) -> Self where F: core::ops::function::FnOnce(T) -> Self
pub fn bitcoin_units::result::NumOpResult<T>::clone(&self) -> bitcoin_units::result::NumOpResult<T>
pub fn bitcoin_units::result::NumOpResult<T>::eq(&self, other: &bitcoin_units::result::NumOpResult<T>) -> bool
pub fn bitcoin_units::result::NumOpResult<T>::expect(self, msg: &str) -> T
@@ -1956,8 +1956,8 @@ pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::mul_assign(&mu
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::mul_assign(&mut self, rhs: u64)
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::rem(self, modulus: u64) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::rem(self, rhs: &u64) -> Self::Output
-pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::result::NumOpResult<bitcoin_units::Amount>>
-pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = bitcoin_units::result::NumOpResult<bitcoin_units::Amount>>
+pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
+pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Amount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = Self>
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>::mul(self, rhs: &bitcoin_units::Weight) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>::mul(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::Weight>) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>::mul(self, rhs: bitcoin_units::Weight) -> Self::Output
@@ -1974,8 +1974,8 @@ pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::mul_assi
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::mul_assign(&mut self, rhs: i64)
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::rem(self, modulus: i64) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::rem(self, rhs: &i64) -> Self::Output
-pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>>
-pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>>
+pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = &'a Self>
+pub fn bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::sum<I>(iter: I) -> Self where I: core::iter::traits::iterator::Iterator<Item = Self>
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::mul(self, rhs: &bitcoin_units::FeeRate) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::mul(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>) -> Self::Output
pub fn bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::mul(self, rhs: bitcoin_units::FeeRate) -> Self::Output
@@ -1986,7 +1986,7 @@ pub fn bitcoin_units::sequence::Sequence::default() -> Self
pub fn bitcoin_units::sequence::Sequence::enables_absolute_lock_time(self) -> bool
pub fn bitcoin_units::sequence::Sequence::eq(&self, other: &bitcoin_units::sequence::Sequence) -> bool
pub fn bitcoin_units::sequence::Sequence::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::sequence::Sequence::from(lt: bitcoin_units::locktime::relative::LockTime) -> bitcoin_units::sequence::Sequence
+pub fn bitcoin_units::sequence::Sequence::from(lt: bitcoin_units::locktime::relative::LockTime) -> Self
pub fn bitcoin_units::sequence::Sequence::from_512_second_intervals(intervals: u16) -> Self
pub fn bitcoin_units::sequence::Sequence::from_consensus(n: u32) -> Self
pub fn bitcoin_units::sequence::Sequence::from_height(height: u16) -> Self
@@ -2012,7 +2012,7 @@ pub fn u32::from(height: bitcoin_units::block::BlockHeight) -> Self
pub fn u32::from(height: bitcoin_units::block::BlockHeightInterval) -> Self
pub fn u32::from(height: bitcoin_units::block::BlockMtp) -> Self
pub fn u32::from(height: bitcoin_units::block::BlockMtpInterval) -> Self
-pub fn u32::from(sequence: bitcoin_units::sequence::Sequence) -> u32
+pub fn u32::from(sequence: bitcoin_units::sequence::Sequence) -> Self
pub fn u32::from(t: bitcoin_units::BlockTime) -> Self
pub fn u64::from(value: bitcoin_units::Weight) -> Self
pub fn u64::mul(self, rhs: &bitcoin_units::Amount) -> Self::Output
diff --git a/units/Cargo.toml b/units/Cargo.toml
index 472508d0..e1e6293d 100644
--- a/units/Cargo.toml
+++ b/units/Cargo.toml
@@ -160,6 +160,7 @@ unreadable_literal = "warn"
unsafe_derive_deserialize = "warn"
unused_async = "warn"
unused_self = "warn"
+use_self = "warn"
used_underscore_binding = "warn"
used_underscore_items = "warn"
verbose_bit_mask = "warn"
diff --git a/units/src/amount/error.rs b/units/src/amount/error.rs
index c888647b..2914c051 100644
--- a/units/src/amount/error.rs
+++ b/units/src/amount/error.rs
@@ -219,7 +219,7 @@ impl std::error::Error for OutOfRangeError {}
impl From<OutOfRangeError> for ParseAmountError {
fn from(value: OutOfRangeError) -> Self {
- ParseAmountError(ParseAmountErrorInner::OutOfRange(value))
+ Self(ParseAmountErrorInner::OutOfRange(value))
}
}
diff --git a/units/src/amount/mod.rs b/units/src/amount/mod.rs
index 07609c2e..b363d9ea 100644
--- a/units/src/amount/mod.rs
+++ b/units/src/amount/mod.rs
@@ -106,47 +106,47 @@ pub enum Denomination {
impl Denomination {
/// Convenience alias for `Denomination::Bitcoin`.
- pub const BTC: Self = Denomination::Bitcoin;
+ pub const BTC: Self = Self::Bitcoin;
/// Convenience alias for `Denomination::Satoshi`.
- pub const SAT: Self = Denomination::Satoshi;
+ pub const SAT: Self = Self::Satoshi;
/// The number of decimal places more than a satoshi.
fn precision(self) -> i8 {
match self {
- Denomination::Bitcoin => -8,
- Denomination::CentiBitcoin => -6,
- Denomination::MilliBitcoin => -5,
- Denomination::MicroBitcoin => -2,
- Denomination::Bit => -2,
- Denomination::Satoshi => 0,
- Denomination::_DoNotUse(infallible) => match infallible {},
+ Self::Bitcoin => -8,
+ Self::CentiBitcoin => -6,
+ Self::MilliBitcoin => -5,
+ Self::MicroBitcoin => -2,
+ Self::Bit => -2,
+ Self::Satoshi => 0,
+ Self::_DoNotUse(infallible) => match infallible {},
}
}
/// Returns a string representation of this denomination.
fn as_str(self) -> &'static str {
match self {
- Denomination::Bitcoin => "BTC",
- Denomination::CentiBitcoin => "cBTC",
- Denomination::MilliBitcoin => "mBTC",
- Denomination::MicroBitcoin => "uBTC",
- Denomination::Bit => "bits",
- Denomination::Satoshi => "satoshi",
- Denomination::_DoNotUse(infallible) => match infallible {},
+ Self::Bitcoin => "BTC",
+ Self::CentiBitcoin => "cBTC",
+ Self::MilliBitcoin => "mBTC",
+ Self::MicroBitcoin => "uBTC",
+ Self::Bit => "bits",
+ Self::Satoshi => "satoshi",
+ Self::_DoNotUse(infallible) => match infallible {},
}
}
/// The different `str` forms of denominations that are recognized.
fn forms(s: &str) -> Option<Self> {
match s {
- "BTC" | "btc" => Some(Denomination::Bitcoin),
- "cBTC" | "cbtc" => Some(Denomination::CentiBitcoin),
- "mBTC" | "mbtc" => Some(Denomination::MilliBitcoin),
- "uBTC" | "ubtc" | "µBTC" | "µbtc" => Some(Denomination::MicroBitcoin),
- "bit" | "bits" | "BIT" | "BITS" => Some(Denomination::Bit),
+ "BTC" | "btc" => Some(Self::Bitcoin),
+ "cBTC" | "cbtc" => Some(Self::CentiBitcoin),
+ "mBTC" | "mbtc" => Some(Self::MilliBitcoin),
+ "uBTC" | "ubtc" | "µBTC" | "µbtc" => Some(Self::MicroBitcoin),
+ "bit" | "bits" | "BIT" | "BITS" => Some(Self::Bit),
"SATOSHI" | "satoshi" | "SATOSHIS" | "satoshis" | "SAT" | "sat" | "SATS" | "sats" =>
- Some(Denomination::Satoshi),
+ Some(Self::Satoshi),
_ => None,
}
}
@@ -177,7 +177,7 @@ impl FromStr for Denomination {
return Err(E::PossiblyConfusing(PossiblyConfusingDenominationError(s.into())));
};
- let form = self::Denomination::forms(s);
+ let form = Self::forms(s);
form.ok_or_else(|| E::Unknown(UnknownDenominationError(s.into())))
}
@@ -369,7 +369,7 @@ struct FormatOptions {
impl FormatOptions {
fn from_formatter(f: &fmt::Formatter) -> Self {
- FormatOptions {
+ Self {
fill: f.fill(),
align: f.align(),
width: f.width(),
@@ -382,7 +382,7 @@ impl FormatOptions {
impl Default for FormatOptions {
fn default() -> Self {
- FormatOptions {
+ Self {
fill: ' ',
align: None,
width: None,
@@ -605,12 +605,12 @@ impl<'a> Arbitrary<'a> for Denomination {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let choice = u.int_in_range(0..=5)?;
match choice {
- 0 => Ok(Denomination::Bitcoin),
- 1 => Ok(Denomination::CentiBitcoin),
- 2 => Ok(Denomination::MilliBitcoin),
- 3 => Ok(Denomination::MicroBitcoin),
- 4 => Ok(Denomination::Bit),
- _ => Ok(Denomination::Satoshi),
+ 0 => Ok(Self::Bitcoin),
+ 1 => Ok(Self::CentiBitcoin),
+ 2 => Ok(Self::MilliBitcoin),
+ 3 => Ok(Self::MicroBitcoin),
+ 4 => Ok(Self::Bit),
+ _ => Ok(Self::Satoshi),
}
}
}
diff --git a/units/src/amount/result.rs b/units/src/amount/result.rs
index a47ecb02..01f8ab07 100644
--- a/units/src/amount/result.rs
+++ b/units/src/amount/result.rs
@@ -253,48 +253,48 @@ impl ops::Neg for SignedAmount {
}
}
-impl core::iter::Sum<NumOpResult<Amount>> for NumOpResult<Amount> {
+impl core::iter::Sum<Self> for NumOpResult<Amount> {
fn sum<I>(iter: I) -> Self
where
- I: Iterator<Item = NumOpResult<Amount>>,
+ I: Iterator<Item = Self>,
{
- iter.fold(R::Valid(Amount::ZERO), |acc, amount| match (acc, amount) {
- (R::Valid(lhs), R::Valid(rhs)) => lhs + rhs,
- (_, _) => R::Error(NumOpError::while_doing(MathOp::Add)),
+ iter.fold(Self::Valid(Amount::ZERO), |acc, amount| match (acc, amount) {
+ (Self::Valid(lhs), Self::Valid(rhs)) => lhs + rhs,
+ (_, _) => Self::Error(NumOpError::while_doing(MathOp::Add)),
})
}
}
-impl<'a> core::iter::Sum<&'a NumOpResult<Amount>> for NumOpResult<Amount> {
+impl<'a> core::iter::Sum<&'a Self> for NumOpResult<Amount> {
fn sum<I>(iter: I) -> Self
where
- I: Iterator<Item = &'a NumOpResult<Amount>>,
+ I: Iterator<Item = &'a Self>,
{
- iter.fold(R::Valid(Amount::ZERO), |acc, amount| match (acc, amount) {
- (R::Valid(lhs), R::Valid(rhs)) => lhs + rhs,
- (_, _) => R::Error(NumOpError::while_doing(MathOp::Add)),
+ iter.fold(Self::Valid(Amount::ZERO), |acc, amount| match (acc, amount) {
+ (Self::Valid(lhs), Self::Valid(rhs)) => lhs + rhs,
+ (_, _) => Self::Error(NumOpError::while_doing(MathOp::Add)),
})
}
}
-impl core::iter::Sum<NumOpResult<SignedAmount>> for NumOpResult<SignedAmount> {
+impl core::iter::Sum<Self> for NumOpResult<SignedAmount> {
fn sum<I>(iter: I) -> Self
where
- I: Iterator<Item = NumOpResult<SignedAmount>>,
+ I: Iterator<Item = Self>,
{
- iter.fold(R::Valid(SignedAmount::ZERO), |acc, amount| match (acc, amount) {
- (R::Valid(lhs), R::Valid(rhs)) => lhs + rhs,
- (_, _) => R::Error(NumOpError::while_doing(MathOp::Add)),
+ iter.fold(Self::Valid(SignedAmount::ZERO), |acc, amount| match (acc, amount) {
+ (Self::Valid(lhs), Self::Valid(rhs)) => lhs + rhs,
+ (_, _) => Self::Error(NumOpError::while_doing(MathOp::Add)),
})
}
}
-impl<'a> core::iter::Sum<&'a NumOpResult<SignedAmount>> for NumOpResult<SignedAmount> {
+impl<'a> core::iter::Sum<&'a Self> for NumOpResult<SignedAmount> {
fn sum<I>(iter: I) -> Self
where
- I: Iterator<Item = &'a NumOpResult<SignedAmount>>,
+ I: Iterator<Item = &'a Self>,
{
- iter.fold(R::Valid(SignedAmount::ZERO), |acc, amount| match (acc, amount) {
- (R::Valid(lhs), R::Valid(rhs)) => lhs + rhs,
- (_, _) => R::Error(NumOpError::while_doing(MathOp::Add)),
+ iter.fold(Self::Valid(SignedAmount::ZERO), |acc, amount| match (acc, amount) {
+ (Self::Valid(lhs), Self::Valid(rhs)) => lhs + rhs,
+ (_, _) => Self::Error(NumOpError::while_doing(MathOp::Add)),
})
}
}
diff --git a/units/src/amount/unsigned.rs b/units/src/amount/unsigned.rs
index e265732e..a8a4e33a 100644
--- a/units/src/amount/unsigned.rs
+++ b/units/src/amount/unsigned.rs
@@ -415,7 +415,7 @@ impl Amount {
/// Since `SignedAmount::MIN` is equivalent to `-Amount::MAX` subtraction of two signed amounts
/// can never overflow a `SignedAmount`.
#[must_use]
- pub fn signed_sub(self, rhs: Amount) -> SignedAmount {
+ pub fn signed_sub(self, rhs: Self) -> SignedAmount {
(self.to_signed() - rhs.to_signed())
.expect("difference of two amounts is always within SignedAmount range")
}
@@ -431,7 +431,7 @@ impl Amount {
if let Some(sats) = self.to_sat().checked_mul(1_000) {
match sats.checked_div(wu) {
Some(fee_rate) =>
- if let Ok(amount) = Amount::from_sat(fee_rate) {
+ if let Ok(amount) = Self::from_sat(fee_rate) {
return FeeRate::from_per_kwu(amount);
},
None => return R::Error(E::while_doing(MathOp::Div)),
@@ -468,7 +468,7 @@ impl Amount {
// No need to use checked arithmetic because wu is non-zero.
if let Some(bump) = sats.checked_add(wu - 1) {
let fee_rate = bump / wu;
- if let Ok(amount) = Amount::from_sat(fee_rate) {
+ if let Ok(amount) = Self::from_sat(fee_rate) {
return FeeRate::from_per_kwu(amount);
}
}
@@ -483,7 +483,7 @@ impl Amount {
/// at the given `fee_rate`. Uses floor division to ensure the resulting weight doesn't cause
/// the fee to exceed the amount.
pub const fn div_by_fee_rate_floor(self, fee_rate: FeeRate) -> NumOpResult<Weight> {
- debug_assert!(Amount::MAX.to_sat().checked_mul(1_000).is_some());
+ debug_assert!(Self::MAX.to_sat().checked_mul(1_000).is_some());
let msats = self.to_sat() * 1_000;
match msats.checked_div(fee_rate.to_sat_per_kwu_ceil()) {
Some(wu) => R::Valid(Weight::from_wu(wu)),
@@ -503,7 +503,7 @@ impl Amount {
return R::Error(E::while_doing(MathOp::Div));
}
- debug_assert!(Amount::MAX.to_sat().checked_mul(1_000).is_some());
+ debug_assert!(Self::MAX.to_sat().checked_mul(1_000).is_some());
let msats = self.to_sat() * 1_000;
match msats.checked_add(rate - 1) {
Some(bump) => {
diff --git a/units/src/block.rs b/units/src/block.rs
index b5d8e5c1..6f9f7dc1 100644
--- a/units/src/block.rs
+++ b/units/src/block.rs
@@ -141,7 +141,7 @@ impl TryFrom<BlockHeight> for absolute::Height {
/// An absolute locktime block height has a maximum value of [`absolute::LOCK_TIME_THRESHOLD`]
/// minus one, while [`BlockHeight`] may take the full range of `u32`.
fn try_from(h: BlockHeight) -> Result<Self, Self::Error> {
- absolute::Height::from_u32(h.to_u32())
+ Self::from_u32(h.to_u32())
}
}
@@ -281,7 +281,7 @@ impl TryFrom<BlockHeightInterval> for relative::NumberOfBlocks {
/// [`BlockHeightInterval`] is a thin wrapper around a `u32`, the two types are not interchangeable.
fn try_from(h: BlockHeightInterval) -> Result<Self, Self::Error> {
u16::try_from(h.to_u32())
- .map(relative::NumberOfBlocks::from)
+ .map(Self::from)
.map_err(|_| TooBigForRelativeHeightError(h.into()))
}
}
@@ -355,7 +355,7 @@ impl TryFrom<BlockMtp> for absolute::MedianTimePast {
/// An absolute locktime MTP has a minimum value of [`absolute::LOCK_TIME_THRESHOLD`],
/// while [`BlockMtp`] may take the full range of `u32`.
fn try_from(h: BlockMtp) -> Result<Self, Self::Error> {
- absolute::MedianTimePast::from_u32(h.to_u32())
+ Self::from_u32(h.to_u32())
}
}
@@ -567,35 +567,35 @@ crate::internal_macros::impl_sub_assign!(BlockMtpInterval);
impl core::iter::Sum for BlockHeightInterval {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
- let sum = iter.map(BlockHeightInterval::to_u32).sum();
- BlockHeightInterval::from_u32(sum)
+ let sum = iter.map(Self::to_u32).sum();
+ Self::from_u32(sum)
}
}
-impl<'a> core::iter::Sum<&'a BlockHeightInterval> for BlockHeightInterval {
+impl<'a> core::iter::Sum<&'a Self> for BlockHeightInterval {
fn sum<I>(iter: I) -> Self
where
- I: Iterator<Item = &'a BlockHeightInterval>,
+ I: Iterator<Item = &'a Self>,
{
let sum = iter.map(|interval| interval.to_u32()).sum();
- BlockHeightInterval::from_u32(sum)
+ Self::from_u32(sum)
}
}
impl core::iter::Sum for BlockMtpInterval {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
- let sum = iter.map(BlockMtpInterval::to_u32).sum();
- BlockMtpInterval::from_u32(sum)
+ let sum = iter.map(Self::to_u32).sum();
+ Self::from_u32(sum)
}
}
-impl<'a> core::iter::Sum<&'a BlockMtpInterval> for BlockMtpInterval {
+impl<'a> core::iter::Sum<&'a Self> for BlockMtpInterval {
fn sum<I>(iter: I) -> Self
where
- I: Iterator<Item = &'a BlockMtpInterval>,
+ I: Iterator<Item = &'a Self>,
{
let sum = iter.map(|interval| interval.to_u32()).sum();
- BlockMtpInterval::from_u32(sum)
+ Self::from_u32(sum)
}
}
diff --git a/units/src/fee_rate/mod.rs b/units/src/fee_rate/mod.rs
index d45ce5ba..8575f7fb 100644
--- a/units/src/fee_rate/mod.rs
+++ b/units/src/fee_rate/mod.rs
@@ -39,35 +39,35 @@ impl FeeRate {
/// The zero fee rate.
///
/// Equivalent to [`MIN`](Self::MIN), may better express intent in some contexts.
- pub const ZERO: FeeRate = FeeRate::from_sat_per_mvb(0);
+ pub const ZERO: Self = Self::from_sat_per_mvb(0);
/// The minimum possible value.
///
/// Equivalent to [`ZERO`](Self::ZERO), may better express intent in some contexts.
- pub const MIN: FeeRate = FeeRate::ZERO;
+ pub const MIN: Self = Self::ZERO;
/// The maximum possible value.
- pub const MAX: FeeRate = FeeRate::from_sat_per_mvb(u64::MAX);
+ pub const MAX: Self = Self::from_sat_per_mvb(u64::MAX);
/// The minimum fee rate required to broadcast a transaction.
///
/// The value matches the default Bitcoin Core policy at the time of library release.
- pub const BROADCAST_MIN: FeeRate = FeeRate::from_sat_per_vb(1);
+ pub const BROADCAST_MIN: Self = Self::from_sat_per_vb(1);
/// The fee rate used to compute dust amount.
- pub const DUST: FeeRate = FeeRate::from_sat_per_vb(3);
+ pub const DUST: Self = Self::from_sat_per_vb(3);
/// Constructs a new [`FeeRate`] from satoshis per 1000 weight units.
pub const fn from_sat_per_kwu(sat_kwu: u32) -> Self {
let fee_rate = (const_casts::u32_to_u64(sat_kwu)) * 4_000;
- FeeRate::from_sat_per_mvb(fee_rate)
+ Self::from_sat_per_mvb(fee_rate)
}
/// Constructs a new [`FeeRate`] from amount per 1000 weight units.
pub const fn from_per_kwu(rate: Amount) -> NumOpResult<Self> {
// No `map()` in const context.
match rate.checked_mul(4_000) {
- Some(per_mvb) => R::Valid(FeeRate::from_sat_per_mvb(per_mvb.to_sat())),
+ Some(per_mvb) => R::Valid(Self::from_sat_per_mvb(per_mvb.to_sat())),
None => R::Error(E::while_doing(MathOp::Mul)),
}
}
@@ -75,14 +75,14 @@ impl FeeRate {
/// Constructs a new [`FeeRate`] from satoshis per virtual byte.
pub const fn from_sat_per_vb(sat_vb: u32) -> Self {
let fee_rate = (const_casts::u32_to_u64(sat_vb)) * 1_000_000;
- FeeRate::from_sat_per_mvb(fee_rate)
+ Self::from_sat_per_mvb(fee_rate)
}
/// Constructs a new [`FeeRate`] from amount per virtual byte.
pub const fn from_per_vb(rate: Amount) -> NumOpResult<Self> {
// No `map()` in const context.
match rate.checked_mul(1_000_000) {
- Some(per_mvb) => R::Valid(FeeRate::from_sat_per_mvb(per_mvb.to_sat())),
+ Some(per_mvb) => R::Valid(Self::from_sat_per_mvb(per_mvb.to_sat())),
None => R::Error(E::while_doing(MathOp::Mul)),
}
}
@@ -90,14 +90,14 @@ impl FeeRate {
/// Constructs a new [`FeeRate`] from satoshis per kilo virtual bytes (1,000 vbytes).
pub const fn from_sat_per_kvb(sat_kvb: u32) -> Self {
let fee_rate = (const_casts::u32_to_u64(sat_kvb)) * 1_000;
- FeeRate::from_sat_per_mvb(fee_rate)
+ Self::from_sat_per_mvb(fee_rate)
}
/// Constructs a new [`FeeRate`] from satoshis per kilo virtual bytes (1,000 vbytes).
pub const fn from_per_kvb(rate: Amount) -> NumOpResult<Self> {
// No `map()` in const context.
match rate.checked_mul(1_000) {
- Some(per_mvb) => R::Valid(FeeRate::from_sat_per_mvb(per_mvb.to_sat())),
+ Some(per_mvb) => R::Valid(Self::from_sat_per_mvb(per_mvb.to_sat())),
None => R::Error(E::while_doing(MathOp::Mul)),
}
}
@@ -148,7 +148,7 @@ impl FeeRate {
///
/// Computes `self + rhs` returning [`None`] in case of overflow.
#[must_use]
- pub const fn checked_add(self, rhs: FeeRate) -> Option<Self> {
+ pub const fn checked_add(self, rhs: Self) -> Option<Self> {
// No `map()` in const context.
match self.to_sat_per_mvb().checked_add(rhs.to_sat_per_mvb()) {
Some(res) => Some(Self::from_sat_per_mvb(res)),
@@ -160,7 +160,7 @@ impl FeeRate {
///
/// Computes `self - rhs`, returning [`None`] if overflow occurred.
#[must_use]
- pub const fn checked_sub(self, rhs: FeeRate) -> Option<Self> {
+ pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
// No `map()` in const context.
match self.to_sat_per_mvb().checked_sub(rhs.to_sat_per_mvb()) {
Some(res) => Some(Self::from_sat_per_mvb(res)),
@@ -249,16 +249,16 @@ impl core::iter::Sum for FeeRate {
where
I: Iterator<Item = Self>,
{
- FeeRate::from_sat_per_mvb(iter.map(FeeRate::to_sat_per_mvb).sum())
+ Self::from_sat_per_mvb(iter.map(Self::to_sat_per_mvb).sum())
}
}
-impl<'a> core::iter::Sum<&'a FeeRate> for FeeRate {
+impl<'a> core::iter::Sum<&'a Self> for FeeRate {
fn sum<I>(iter: I) -> Self
where
- I: Iterator<Item = &'a FeeRate>,
+ I: Iterator<Item = &'a Self>,
{
- FeeRate::from_sat_per_mvb(iter.map(|f| FeeRate::to_sat_per_mvb(*f)).sum())
+ Self::from_sat_per_mvb(iter.map(|f| Self::to_sat_per_mvb(*f)).sum())
}
}
@@ -267,11 +267,11 @@ impl<'a> Arbitrary<'a> for FeeRate {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let choice = u.int_in_range(0..=4)?;
match choice {
- 0 => Ok(FeeRate::MIN),
- 1 => Ok(FeeRate::BROADCAST_MIN),
- 2 => Ok(FeeRate::DUST),
- 3 => Ok(FeeRate::MAX),
- _ => Ok(FeeRate::from_sat_per_mvb(u64::arbitrary(u)?)),
+ 0 => Ok(Self::MIN),
+ 1 => Ok(Self::BROADCAST_MIN),
+ 2 => Ok(Self::DUST),
+ 3 => Ok(Self::MAX),
+ _ => Ok(Self::from_sat_per_mvb(u64::arbitrary(u)?)),
}
}
}
diff --git a/units/src/locktime/absolute/error.rs b/units/src/locktime/absolute/error.rs
index 5a9d6335..73429b2f 100644
--- a/units/src/locktime/absolute/error.rs
+++ b/units/src/locktime/absolute/error.rs
@@ -275,11 +275,11 @@ enum LockTimeUnit {
impl fmt::Display for LockTimeUnit {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- use LockTimeUnit as L;
+
match *self {
- L::Blocks => write!(f, "expected lock-by-height (must be < {})", LOCK_TIME_THRESHOLD),
- L::Seconds => write!(f, "expected lock-by-time (must be >= {})", LOCK_TIME_THRESHOLD),
+ Self::Blocks => write!(f, "expected lock-by-height (must be < {})", LOCK_TIME_THRESHOLD),
+ Self::Seconds => write!(f, "expected lock-by-time (must be >= {})", LOCK_TIME_THRESHOLD),
}
}
}
diff --git a/units/src/locktime/absolute/mod.rs b/units/src/locktime/absolute/mod.rs
index 223f0291..a4ba9955 100644
--- a/units/src/locktime/absolute/mod.rs
+++ b/units/src/locktime/absolute/mod.rs
@@ -107,7 +107,7 @@ pub enum LockTime {
impl LockTime {
/// If transaction lock time is set to zero it is ignored, in other words a
/// transaction with nLocktime==0 is able to be included immediately in any block.
- pub const ZERO: LockTime = LockTime::Blocks(Height::ZERO);
+ pub const ZERO: Self = Self::Blocks(Height::ZERO);
/// The number of bytes that the locktime contributes to the size of a transaction.
pub const SIZE: usize = 4; // Serialized length of a u32.
@@ -204,7 +204,7 @@ impl LockTime {
#[inline]
pub fn from_height(n: u32) -> Result<Self, ConversionError> {
let height = Height::from_u32(n)?;
- Ok(LockTime::Blocks(height))
+ Ok(Self::Blocks(height))
}
#[inline]
@@ -240,22 +240,22 @@ impl LockTime {
#[inline]
pub fn from_mtp(n: u32) -> Result<Self, ConversionError> {
let time = MedianTimePast::from_u32(n)?;
- Ok(LockTime::Seconds(time))
+ Ok(Self::Seconds(time))
}
/// Returns true if both lock times use the same unit i.e., both height based or both time based.
#[inline]
- pub const fn is_same_unit(self, other: LockTime) -> bool {
+ pub const fn is_same_unit(self, other: Self) -> bool {
matches!(
(self, other),
- (LockTime::Blocks(_), LockTime::Blocks(_))
- | (LockTime::Seconds(_), LockTime::Seconds(_))
+ (Self::Blocks(_), Self::Blocks(_))
+ | (Self::Seconds(_), Self::Seconds(_))
)
}
/// Returns true if this lock time value is a block height.
#[inline]
- pub const fn is_block_height(self) -> bool { matches!(self, LockTime::Blocks(_)) }
+ pub const fn is_block_height(self) -> bool { matches!(self, Self::Blocks(_)) }
/// Returns true if this lock time value is a block time (UNIX timestamp).
#[inline]
@@ -293,8 +293,8 @@ impl LockTime {
#[inline]
pub fn is_satisfied_by(self, height: Height, mtp: MedianTimePast) -> bool {
match self {
- LockTime::Blocks(blocks) => blocks.is_satisfied_by(height),
- LockTime::Seconds(time) => time.is_satisfied_by(mtp),
+ Self::Blocks(blocks) => blocks.is_satisfied_by(height),
+ Self::Seconds(time) => time.is_satisfied_by(mtp),
}
}
@@ -308,11 +308,11 @@ impl LockTime {
/// Returns an error if this lock is not lock-by-height.
#[inline]
pub fn is_satisfied_by_height(self, height: Height) -> Result<bool, IncompatibleHeightError> {
- use LockTime as L;
+
match self {
- L::Blocks(blocks) => Ok(blocks.is_satisfied_by(height)),
- L::Seconds(time) => Err(IncompatibleHeightError { lock: time, incompatible: height }),
+ Self::Blocks(blocks) => Ok(blocks.is_satisfied_by(height)),
+ Self::Seconds(time) => Err(IncompatibleHeightError { lock: time, incompatible: height }),
}
}
@@ -323,11 +323,11 @@ impl LockTime {
/// Returns an error if this lock is not lock-by-time.
#[inline]
pub fn is_satisfied_by_time(self, mtp: MedianTimePast) -> Result<bool, IncompatibleTimeError> {
- use LockTime as L;
+
match self {
- L::Seconds(time) => Ok(time.is_satisfied_by(mtp)),
- L::Blocks(blocks) => Err(IncompatibleTimeError { lock: blocks, incompatible: mtp }),
+ Self::Seconds(time) => Ok(time.is_satisfied_by(mtp)),
+ Self::Blocks(blocks) => Err(IncompatibleTimeError { lock: blocks, incompatible: mtp }),
}
}
@@ -357,12 +357,12 @@ impl LockTime {
/// assert!(lock_time.is_implied_by(check));
/// ```
#[inline]
- pub fn is_implied_by(self, other: LockTime) -> bool {
- use LockTime as L;
+ pub fn is_implied_by(self, other: Self) -> bool {
+
match (self, other) {
- (L::Blocks(this), L::Blocks(other)) => this <= other,
- (L::Seconds(this), L::Seconds(other)) => this <= other,
+ (Self::Blocks(this), Self::Blocks(other)) => this <= other,
+ (Self::Seconds(this), Self::Seconds(other)) => this <= other,
_ => false, // Not the same units.
}
}
@@ -395,8 +395,8 @@ impl LockTime {
#[inline]
pub fn to_consensus_u32(self) -> u32 {
match self {
- LockTime::Blocks(ref h) => h.to_u32(),
- LockTime::Seconds(ref t) => t.to_u32(),
+ Self::Blocks(ref h) => h.to_u32(),
+ Self::Seconds(ref t) => t.to_u32(),
}
}
}
@@ -462,39 +462,39 @@ impl encoding::Decodable for LockTime {
impl From<Height> for LockTime {
#[inline]
- fn from(h: Height) -> Self { LockTime::Blocks(h) }
+ fn from(h: Height) -> Self { Self::Blocks(h) }
}
impl From<MedianTimePast> for LockTime {
#[inline]
- fn from(t: MedianTimePast) -> Self { LockTime::Seconds(t) }
+ fn from(t: MedianTimePast) -> Self { Self::Seconds(t) }
}
impl fmt::Debug for LockTime {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- use LockTime as L;
+
match *self {
- L::Blocks(ref h) => write!(f, "{} blocks", h),
- L::Seconds(ref t) => write!(f, "{} seconds", t),
+ Self::Blocks(ref h) => write!(f, "{} blocks", h),
+ Self::Seconds(ref t) => write!(f, "{} seconds", t),
}
}
}
impl fmt::Display for LockTime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- use LockTime as L;
+
if f.alternate() {
match *self {
- L::Blocks(ref h) => write!(f, "block-height {}", h),
- L::Seconds(ref t) => write!(f, "block-time {} (seconds since epoch)", t),
+ Self::Blocks(ref h) => write!(f, "block-height {}", h),
+ Self::Seconds(ref t) => write!(f, "block-time {} (seconds since epoch)", t),
}
} else {
match *self {
- L::Blocks(ref h) => fmt::Display::fmt(h, f),
- L::Seconds(ref t) => fmt::Display::fmt(t, f),
+ Self::Blocks(ref h) => fmt::Display::fmt(h, f),
+ Self::Seconds(ref t) => fmt::Display::fmt(t, f),
}
}
}
@@ -526,13 +526,13 @@ pub struct Height(u32);
impl Height {
/// Absolute block height 0, the genesis block.
- pub const ZERO: Self = Height(0);
+ pub const ZERO: Self = Self(0);
/// The minimum absolute block height (0), the genesis block.
pub const MIN: Self = Self::ZERO;
/// The maximum absolute block height.
- pub const MAX: Self = Height(LOCK_TIME_THRESHOLD - 1);
+ pub const MAX: Self = Self(LOCK_TIME_THRESHOLD - 1);
/// Constructs a new [`Height`] from a hex string.
///
@@ -569,7 +569,7 @@ impl Height {
/// # Ok::<_, absolute::error::ConversionError>(())
/// ```
#[inline]
- pub const fn from_u32(n: u32) -> Result<Height, ConversionError> {
+ pub const fn from_u32(n: u32) -> Result<Self, ConversionError> {
if is_block_height(n) {
Ok(Self(n))
} else {
@@ -594,7 +594,7 @@ impl Height {
/// `self` is value of the `LockTime` and if `height` is the current chain tip then
/// a transaction with this lock can be broadcast for inclusion in the next block.
#[inline]
- pub fn is_satisfied_by(self, height: Height) -> bool {
+ pub fn is_satisfied_by(self, height: Self) -> bool {
// Use u64 so that there can be no overflow.
let next_block_height = u64::from(height.to_u32()) + 1;
u64::from(self.to_u32()) <= next_block_height
@@ -624,10 +624,10 @@ pub struct MedianTimePast(u32);
impl MedianTimePast {
/// The minimum MTP allowable in a locktime (Tue Nov 05 1985 00:53:20 GMT+0000).
- pub const MIN: Self = MedianTimePast(LOCK_TIME_THRESHOLD);
+ pub const MIN: Self = Self(LOCK_TIME_THRESHOLD);
/// The maximum MTP allowable in a locktime (Sun Feb 07 2106 06:28:15 GMT+0000).
- pub const MAX: Self = MedianTimePast(u32::MAX);
+ pub const MAX: Self = Self(u32::MAX);
/// Constructs an [`MedianTimePast`] by computing the median-time-past from the last
/// 11 block timestamps.
@@ -709,7 +709,7 @@ impl MedianTimePast {
/// the chain tip then a transaction with this lock can be broadcast for inclusion in the next
/// block.
#[inline]
- pub fn is_satisfied_by(self, time: MedianTimePast) -> bool {
+ pub fn is_satisfied_by(self, time: Self) -> bool {
// The locktime check in Core during block validation uses the MTP
// of the previous block - which is the expected to be `time` here.
self <= time
@@ -757,7 +757,7 @@ pub const fn is_block_time(n: u32) -> bool { n >= LOCK_TIME_THRESHOLD }
impl<'a> Arbitrary<'a> for LockTime {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let l = u32::arbitrary(u)?;
- Ok(LockTime::from_consensus(l))
+ Ok(Self::from_consensus(l))
}
}
@@ -766,13 +766,13 @@ impl<'a> Arbitrary<'a> for Height {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let choice = u.int_in_range(0..=2)?;
match choice {
- 0 => Ok(Height::MIN),
- 1 => Ok(Height::MAX),
+ 0 => Ok(Self::MIN),
+ 1 => Ok(Self::MAX),
_ => {
- let min = Height::MIN.to_u32();
- let max = Height::MAX.to_u32();
+ let min = Self::MIN.to_u32();
+ let max = Self::MAX.to_u32();
let h = u.int_in_range(min..=max)?;
- Ok(Height::from_u32(h).unwrap())
+ Ok(Self::from_u32(h).unwrap())
}
}
}
@@ -783,13 +783,13 @@ impl<'a> Arbitrary<'a> for MedianTimePast {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let choice = u.int_in_range(0..=2)?;
match choice {
- 0 => Ok(MedianTimePast::MIN),
- 1 => Ok(MedianTimePast::MAX),
+ 0 => Ok(Self::MIN),
+ 1 => Ok(Self::MAX),
_ => {
- let min = MedianTimePast::MIN.to_u32();
- let max = MedianTimePast::MAX.to_u32();
+ let min = Self::MIN.to_u32();
+ let max = Self::MAX.to_u32();
let t = u.int_in_range(min..=max)?;
- Ok(MedianTimePast::from_u32(t).unwrap())
+ Ok(Self::from_u32(t).unwrap())
}
}
}
diff --git a/units/src/locktime/relative/error.rs b/units/src/locktime/relative/error.rs
index ec18483a..435189d8 100644
--- a/units/src/locktime/relative/error.rs
+++ b/units/src/locktime/relative/error.rs
@@ -42,11 +42,11 @@ pub enum IsSatisfiedByError {
impl fmt::Display for IsSatisfiedByError {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- use IsSatisfiedByError as E;
+
match *self {
- E::Blocks(ref e) => write_err!(f, "blocks"; e),
- E::Time(ref e) => write_err!(f, "time"; e),
+ Self::Blocks(ref e) => write_err!(f, "blocks"; e),
+ Self::Time(ref e) => write_err!(f, "time"; e),
}
}
}
@@ -54,11 +54,11 @@ impl fmt::Display for IsSatisfiedByError {
#[cfg(feature = "std")]
impl std::error::Error for IsSatisfiedByError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
- use IsSatisfiedByError as E;
+
match *self {
- E::Blocks(ref e) => Some(e),
- E::Time(ref e) => Some(e),
+ Self::Blocks(ref e) => Some(e),
+ Self::Time(ref e) => Some(e),
}
}
}
@@ -76,11 +76,11 @@ pub enum IsSatisfiedByHeightError {
impl fmt::Display for IsSatisfiedByHeightError {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- use IsSatisfiedByHeightError as E;
+
match *self {
- E::Satisfaction(ref e) => write_err!(f, "satisfaction"; e),
- E::Incompatible(time) =>
+ Self::Satisfaction(ref e) => write_err!(f, "satisfaction"; e),
+ Self::Incompatible(time) =>
write!(f, "tried to satisfy a lock-by-height locktime using seconds {}", time),
}
}
@@ -89,11 +89,11 @@ impl fmt::Display for IsSatisfiedByHeightError {
#[cfg(feature = "std")]
impl std::error::Error for IsSatisfiedByHeightError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
- use IsSatisfiedByHeightError as E;
+
match *self {
- E::Satisfaction(ref e) => Some(e),
- E::Incompatible(_) => None,
+ Self::Satisfaction(ref e) => Some(e),
+ Self::Incompatible(_) => None,
}
}
}
@@ -111,11 +111,11 @@ pub enum IsSatisfiedByTimeError {
impl fmt::Display for IsSatisfiedByTimeError {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- use IsSatisfiedByTimeError as E;
+
match *self {
- E::Satisfaction(ref e) => write_err!(f, "satisfaction"; e),
- E::Incompatible(blocks) =>
+ Self::Satisfaction(ref e) => write_err!(f, "satisfaction"; e),
+ Self::Incompatible(blocks) =>
write!(f, "tried to satisfy a lock-by-time locktime using blocks {}", blocks),
}
}
@@ -124,11 +124,11 @@ impl fmt::Display for IsSatisfiedByTimeError {
#[cfg(feature = "std")]
impl std::error::Error for IsSatisfiedByTimeError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
- use IsSatisfiedByTimeError as E;
+
match *self {
- E::Satisfaction(ref e) => Some(e),
- E::Incompatible(_) => None,
+ Self::Satisfaction(ref e) => Some(e),
+ Self::Incompatible(_) => None,
}
}
}
diff --git a/units/src/locktime/relative/mod.rs b/units/src/locktime/relative/mod.rs
index de1719fc..0d32181c 100644
--- a/units/src/locktime/relative/mod.rs
+++ b/units/src/locktime/relative/mod.rs
@@ -51,7 +51,7 @@ pub enum LockTime {
impl LockTime {
/// A relative locktime of 0 is always valid, and is assumed valid for inputs that
/// are not yet confirmed.
- pub const ZERO: LockTime = LockTime::Blocks(NumberOfBlocks::ZERO);
+ pub const ZERO: Self = Self::Blocks(NumberOfBlocks::ZERO);
/// The number of bytes that the locktime contributes to the size of a transaction.
pub const SIZE: usize = 4; // Serialized length of a u32.
@@ -101,8 +101,8 @@ impl LockTime {
#[inline]
pub fn to_consensus_u32(self) -> u32 {
match self {
- LockTime::Blocks(ref h) => u32::from(h.to_height()),
- LockTime::Time(ref t) =>
+ Self::Blocks(ref h) => u32::from(h.to_height()),
+ Self::Time(ref t) =>
Sequence::LOCK_TYPE_MASK | u32::from(t.to_512_second_intervals()),
}
}
@@ -139,7 +139,7 @@ impl LockTime {
/// Constructs a new `LockTime` from `n`, expecting `n` to be a 16-bit count of blocks.
#[inline]
- pub const fn from_height(n: u16) -> Self { LockTime::Blocks(NumberOfBlocks::from_height(n)) }
+ pub const fn from_height(n: u16) -> Self { Self::Blocks(NumberOfBlocks::from_height(n)) }
/// Constructs a new `LockTime` from `n`, expecting `n` to be a count of 512-second intervals.
///
@@ -147,7 +147,7 @@ impl LockTime {
/// [`Self::from_seconds_floor`] or [`Self::from_seconds_ceil`].
#[inline]
pub const fn from_512_second_intervals(intervals: u16) -> Self {
- LockTime::Time(NumberOf512Seconds::from_512_second_intervals(intervals))
+ Self::Time(NumberOf512Seconds::from_512_second_intervals(intervals))
}
/// Constructs a new [`LockTime`] from seconds, converting the seconds into 512 second interval
@@ -159,7 +159,7 @@ impl LockTime {
#[inline]
pub const fn from_seconds_floor(seconds: u32) -> Result<Self, TimeOverflowError> {
match NumberOf512Seconds::from_seconds_floor(seconds) {
- Ok(time) => Ok(LockTime::Time(time)),
+ Ok(time) => Ok(Self::Time(time)),
Err(e) => Err(e),
}
}
@@ -173,23 +173,23 @@ impl LockTime {
#[inline]
pub const fn from_seconds_ceil(seconds: u32) -> Result<Self, TimeOverflowError> {
match NumberOf512Seconds::from_seconds_ceil(seconds) {
- Ok(time) => Ok(LockTime::Time(time)),
+ Ok(time) => Ok(Self::Time(time)),
Err(e) => Err(e),
}
}
/// Returns true if both lock times use the same unit i.e., both height based or both time based.
#[inline]
- pub const fn is_same_unit(self, other: LockTime) -> bool {
+ pub const fn is_same_unit(self, other: Self) -> bool {
matches!(
(self, other),
- (LockTime::Blocks(_), LockTime::Blocks(_)) | (LockTime::Time(_), LockTime::Time(_))
+ (Self::Blocks(_), Self::Blocks(_)) | (Self::Time(_), Self::Time(_))
)
}
/// Returns true if this lock time value is in units of block height.
#[inline]
- pub const fn is_block_height(self) -> bool { matches!(self, LockTime::Blocks(_)) }
+ pub const fn is_block_height(self) -> bool { matches!(self, Self::Blocks(_)) }
/// Returns true if this lock time value is in units of time.
#[inline]
@@ -211,10 +211,10 @@ impl LockTime {
utxo_mined_at_mtp: BlockMtp,
) -> Result<bool, IsSatisfiedByError> {
match self {
- LockTime::Blocks(blocks) => blocks
+ Self::Blocks(blocks) => blocks
.is_satisfied_by(chain_tip_height, utxo_mined_at_height)
.map_err(IsSatisfiedByError::Blocks),
- LockTime::Time(time) => time
+ Self::Time(time) => time
.is_satisfied_by(chain_tip_mtp, utxo_mined_at_mtp)
.map_err(IsSatisfiedByError::Time),
}
@@ -234,13 +234,13 @@ impl LockTime {
chain_tip: BlockHeight,
utxo_mined_at: BlockHeight,
) -> Result<bool, IsSatisfiedByHeightError> {
- use LockTime as L;
+
match self {
- L::Blocks(blocks) => blocks
+ Self::Blocks(blocks) => blocks
.is_satisfied_by(chain_tip, utxo_mined_at)
.map_err(IsSatisfiedByHeightError::Satisfaction),
- L::Time(time) => Err(IsSatisfiedByHeightError::Incompatible(time)),
+ Self::Time(time) => Err(IsSatisfiedByHeightError::Incompatible(time)),
}
}
@@ -258,13 +258,13 @@ impl LockTime {
chain_tip: BlockMtp,
utxo_mined_at: BlockMtp,
) -> Result<bool, IsSatisfiedByTimeError> {
- use LockTime as L;
+
match self {
- L::Time(time) => time
+ Self::Time(time) => time
.is_satisfied_by(chain_tip, utxo_mined_at)
.map_err(IsSatisfiedByTimeError::Satisfaction),
- L::Blocks(blocks) => Err(IsSatisfiedByTimeError::Incompatible(blocks)),
+ Self::Blocks(blocks) => Err(IsSatisfiedByTimeError::Incompatible(blocks)),
}
}
@@ -298,12 +298,12 @@ impl LockTime {
/// assert!(satisfied);
/// ```
#[inline]
- pub fn is_implied_by(self, other: LockTime) -> bool {
- use LockTime as L;
+ pub fn is_implied_by(self, other: Self) -> bool {
+
match (self, other) {
- (L::Blocks(this), L::Blocks(other)) => this <= other,
- (L::Time(this), L::Time(other)) => this <= other,
+ (Self::Blocks(this), Self::Blocks(other)) => this <= other,
+ (Self::Time(this), Self::Time(other)) => this <= other,
_ => false, // Not the same units.
}
}
@@ -330,7 +330,7 @@ impl LockTime {
/// ```
#[inline]
pub fn is_implied_by_sequence(self, other: Sequence) -> bool {
- if let Ok(other) = LockTime::from_sequence(other) {
+ if let Ok(other) = Self::from_sequence(other) {
self.is_implied_by(other)
} else {
false
@@ -340,27 +340,27 @@ impl LockTime {
impl From<NumberOfBlocks> for LockTime {
#[inline]
- fn from(h: NumberOfBlocks) -> Self { LockTime::Blocks(h) }
+ fn from(h: NumberOfBlocks) -> Self { Self::Blocks(h) }
}
impl From<NumberOf512Seconds> for LockTime {
#[inline]
- fn from(t: NumberOf512Seconds) -> Self { LockTime::Time(t) }
+ fn from(t: NumberOf512Seconds) -> Self { Self::Time(t) }
}
impl fmt::Display for LockTime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- use LockTime as L;
+
if f.alternate() {
match *self {
- L::Blocks(ref h) => write!(f, "block-height {}", h),
- L::Time(ref t) => write!(f, "block-time {} (512 second intervals)", t),
+ Self::Blocks(ref h) => write!(f, "block-height {}", h),
+ Self::Time(ref t) => write!(f, "block-time {} (512 second intervals)", t),
}
} else {
match *self {
- L::Blocks(ref h) => fmt::Display::fmt(h, f),
- L::Time(ref t) => fmt::Display::fmt(t, f),
+ Self::Blocks(ref h) => fmt::Display::fmt(h, f),
+ Self::Time(ref t) => fmt::Display::fmt(t, f),
}
}
}
@@ -369,14 +369,14 @@ impl fmt::Display for LockTime {
impl convert::TryFrom<Sequence> for LockTime {
type Error = DisabledLockTimeError;
#[inline]
- fn try_from(seq: Sequence) -> Result<LockTime, DisabledLockTimeError> {
- LockTime::from_sequence(seq)
+ fn try_from(seq: Sequence) -> Result<Self, DisabledLockTimeError> {
+ Self::from_sequence(seq)
}
}
impl From<LockTime> for Sequence {
#[inline]
- fn from(lt: LockTime) -> Sequence { lt.to_sequence() }
+ fn from(lt: LockTime) -> Self { lt.to_sequence() }
}
#[cfg(feature = "serde")]
@@ -470,7 +470,7 @@ impl NumberOfBlocks {
impl From<u16> for NumberOfBlocks {
#[inline]
- fn from(value: u16) -> Self { NumberOfBlocks(value) }
+ fn from(value: u16) -> Self { Self(value) }
}
parse_int::impl_parse_str_from_int_infallible!(NumberOfBlocks, u16, from);
@@ -491,20 +491,20 @@ pub struct NumberOf512Seconds(u16);
impl NumberOf512Seconds {
/// Relative block time 0, can be included in any block.
- pub const ZERO: Self = NumberOf512Seconds(0);
+ pub const ZERO: Self = Self(0);
/// The minimum relative block time (0), can be included in any block.
- pub const MIN: Self = NumberOf512Seconds::ZERO;
+ pub const MIN: Self = Self::ZERO;
/// The maximum relative block time (33,554,432 seconds or approx 388 days).
- pub const MAX: Self = NumberOf512Seconds(u16::MAX);
+ pub const MAX: Self = Self(u16::MAX);
/// Constructs a new [`NumberOf512Seconds`] using time intervals where each interval is
/// equivalent to 512 seconds.
///
/// Encoding finer granularity of time for relative lock-times is not supported in Bitcoin.
#[inline]
- pub const fn from_512_second_intervals(intervals: u16) -> Self { NumberOf512Seconds(intervals) }
+ pub const fn from_512_second_intervals(intervals: u16) -> Self { Self(intervals) }
/// Express the [`NumberOf512Seconds`] as an integer number of 512-second intervals.
#[inline]
@@ -522,7 +522,7 @@ impl NumberOf512Seconds {
pub const fn from_seconds_floor(seconds: u32) -> Result<Self, TimeOverflowError> {
let interval = seconds / 512;
if interval <= u16::MAX as u32 { // infallible cast, needed by const code
- Ok(NumberOf512Seconds::from_512_second_intervals(interval as u16)) // Cast checked above, needed by const code.
+ Ok(Self::from_512_second_intervals(interval as u16)) // Cast checked above, needed by const code.
} else {
Err(TimeOverflowError { seconds })
}
@@ -539,7 +539,7 @@ impl NumberOf512Seconds {
pub const fn from_seconds_ceil(seconds: u32) -> Result<Self, TimeOverflowError> {
if seconds <= u16::MAX as u32 * 512 {
let interval = seconds.div_ceil(512);
- Ok(NumberOf512Seconds::from_512_second_intervals(interval as u16)) // Cast checked above, needed by const code.
+ Ok(Self::from_512_second_intervals(interval as u16)) // Cast checked above, needed by const code.
} else {
Err(TimeOverflowError { seconds })
}
@@ -599,9 +599,9 @@ impl<'a> Arbitrary<'a> for NumberOfBlocks {
let choice = u.int_in_range(0..=2)?;
match choice {
- 0 => Ok(NumberOfBlocks::MIN),
- 1 => Ok(NumberOfBlocks::MAX),
- _ => Ok(NumberOfBlocks::from_height(u16::arbitrary(u)?)),
+ 0 => Ok(Self::MIN),
+ 1 => Ok(Self::MAX),
+ _ => Ok(Self::from_height(u16::arbitrary(u)?)),
}
}
}
@@ -612,9 +612,9 @@ impl<'a> Arbitrary<'a> for NumberOf512Seconds {
let choice = u.int_in_range(0..=2)?;
match choice {
- 0 => Ok(NumberOf512Seconds::MIN),
- 1 => Ok(NumberOf512Seconds::MAX),
- _ => Ok(NumberOf512Seconds::from_512_second_intervals(u16::arbitrary(u)?)),
+ 0 => Ok(Self::MIN),
+ 1 => Ok(Self::MAX),
+ _ => Ok(Self::from_512_second_intervals(u16::arbitrary(u)?)),
}
}
}
diff --git a/units/src/parse_int.rs b/units/src/parse_int.rs
index 70cac330..1c4591fe 100644
--- a/units/src/parse_int.rs
+++ b/units/src/parse_int.rs
@@ -549,11 +549,11 @@ mod tests {
type Err = core::num::ParseIntError;
fn from_str(_: &str) -> Result<Self, Self::Err> {
- "Always invalid for testing".parse::<u32>().map(|_| TestTypeLargerThanU128(0, 0))
+ "Always invalid for testing".parse::<u32>().map(|_| Self(0, 0))
}
}
impl From<i8> for TestTypeLargerThanU128 {
- fn from(_: i8) -> Self { TestTypeLargerThanU128(0, 0) }
+ fn from(_: i8) -> Self { Self(0, 0) }
}
let result = panic::catch_unwind(|| int_from_str::<TestTypeLargerThanU128>("not a number"));
diff --git a/units/src/result.rs b/units/src/result.rs
index 975c7d54..b616e5bb 100644
--- a/units/src/result.rs
+++ b/units/src/result.rs
@@ -95,8 +95,8 @@ impl<T> NumOpResult<T> {
#[inline]
pub fn map<U, F: FnOnce(T) -> U>(self, op: F) -> NumOpResult<U> {
match self {
- NumOpResult::Valid(t) => NumOpResult::Valid(op(t)),
- NumOpResult::Error(e) => NumOpResult::Error(e),
+ Self::Valid(t) => NumOpResult::Valid(op(t)),
+ Self::Error(e) => NumOpResult::Error(e),
}
}
}
@@ -111,8 +111,8 @@ impl<T: fmt::Debug> NumOpResult<T> {
#[track_caller]
pub fn expect(self, msg: &str) -> T {
match self {
- R::Valid(x) => x,
- R::Error(_) => panic!("{}", msg),
+ Self::Valid(x) => x,
+ Self::Error(_) => panic!("{}", msg),
}
}
@@ -125,8 +125,8 @@ impl<T: fmt::Debug> NumOpResult<T> {
#[track_caller]
pub fn unwrap(self) -> T {
match self {
- R::Valid(x) => x,
- R::Error(e) => panic!("tried to unwrap an invalid numeric result: {:?}", e),
+ Self::Valid(x) => x,
+ Self::Error(e) => panic!("tried to unwrap an invalid numeric result: {:?}", e),
}
}
@@ -139,8 +139,8 @@ impl<T: fmt::Debug> NumOpResult<T> {
#[track_caller]
pub fn unwrap_err(self) -> NumOpError {
match self {
- R::Error(e) => e,
- R::Valid(a) => panic!("tried to unwrap a valid numeric result: {:?}", a),
+ Self::Error(e) => e,
+ Self::Valid(a) => panic!("tried to unwrap a valid numeric result: {:?}", a),
}
}
@@ -152,8 +152,8 @@ impl<T: fmt::Debug> NumOpResult<T> {
#[track_caller]
pub fn unwrap_or(self, default: T) -> T {
match self {
- R::Valid(x) => x,
- R::Error(_) => default,
+ Self::Valid(x) => x,
+ Self::Error(_) => default,
}
}
@@ -165,8 +165,8 @@ impl<T: fmt::Debug> NumOpResult<T> {
F: FnOnce() -> T,
{
match self {
- R::Valid(x) => x,
- R::Error(_) => f(),
+ Self::Valid(x) => x,
+ Self::Error(_) => f(),
}
}
@@ -174,8 +174,8 @@ impl<T: fmt::Debug> NumOpResult<T> {
#[inline]
pub fn ok(self) -> Option<T> {
match self {
- R::Valid(x) => Some(x),
- R::Error(_) => None,
+ Self::Valid(x) => Some(x),
+ Self::Error(_) => None,
}
}
@@ -184,20 +184,20 @@ impl<T: fmt::Debug> NumOpResult<T> {
#[allow(clippy::missing_errors_doc)]
pub fn into_result(self) -> Result<T, NumOpError> {
match self {
- R::Valid(x) => Ok(x),
- R::Error(e) => Err(e),
+ Self::Valid(x) => Ok(x),
+ Self::Error(e) => Err(e),
}
}
/// Calls `op` if the numeric result is `Valid`, otherwise returns the `Error` value of `self`.
#[inline]
- pub fn and_then<F>(self, op: F) -> NumOpResult<T>
+ pub fn and_then<F>(self, op: F) -> Self
where
- F: FnOnce(T) -> NumOpResult<T>,
+ F: FnOnce(T) -> Self,
{
match self {
- R::Valid(x) => op(x),
- R::Error(e) => R::Error(e),
+ Self::Valid(x) => op(x),
+ Self::Error(e) => Self::Error(e),
}
}
@@ -205,8 +205,8 @@ impl<T: fmt::Debug> NumOpResult<T> {
#[inline]
pub fn is_valid(&self) -> bool {
match self {
- R::Valid(_) => true,
- R::Error(_) => false,
+ Self::Valid(_) => true,
+ Self::Error(_) => false,
}
}
@@ -243,7 +243,7 @@ pub struct NumOpError(MathOp);
impl NumOpError {
/// Constructs a [`NumOpError`] caused by `op`.
- pub(crate) const fn while_doing(op: MathOp) -> Self { NumOpError(op) }
+ pub(crate) const fn while_doing(op: MathOp) -> Self { Self(op) }
/// Returns `true` if this operation error'ed due to overflow.
pub fn is_overflow(self) -> bool { self.0.is_overflow() }
@@ -289,35 +289,35 @@ pub enum MathOp {
impl MathOp {
/// Returns `true` if this operation error'ed due to overflow.
pub fn is_overflow(self) -> bool {
- matches!(self, MathOp::Add | MathOp::Sub | MathOp::Mul | MathOp::Neg)
+ matches!(self, Self::Add | Self::Sub | Self::Mul | Self::Neg)
}
/// Returns `true` if this operation error'ed due to division by zero.
pub fn is_div_by_zero(self) -> bool { !self.is_overflow() }
/// Returns `true` if this operation error'ed due to addition.
- pub fn is_addition(self) -> bool { self == MathOp::Add }
+ pub fn is_addition(self) -> bool { self == Self::Add }
/// Returns `true` if this operation error'ed due to subtraction.
- pub fn is_subtraction(self) -> bool { self == MathOp::Sub }
+ pub fn is_subtraction(self) -> bool { self == Self::Sub }
/// Returns `true` if this operation error'ed due to multiplication.
- pub fn is_multiplication(self) -> bool { self == MathOp::Mul }
+ pub fn is_multiplication(self) -> bool { self == Self::Mul }
/// Returns `true` if this operation error'ed due to negation.
- pub fn is_negation(self) -> bool { self == MathOp::Neg }
+ pub fn is_negation(self) -> bool { self == Self::Neg }
}
impl fmt::Display for MathOp {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
- MathOp::Add => write!(f, "add"),
- MathOp::Sub => write!(f, "sub"),
- MathOp::Mul => write!(f, "mul"),
- MathOp::Div => write!(f, "div"),
- MathOp::Rem => write!(f, "rem"),
- MathOp::Neg => write!(f, "neg"),
- MathOp::_DoNotUse(infallible) => match infallible {},
+ Self::Add => write!(f, "add"),
+ Self::Sub => write!(f, "sub"),
+ Self::Mul => write!(f, "mul"),
+ Self::Div => write!(f, "div"),
+ Self::Rem => write!(f, "rem"),
+ Self::Neg => write!(f, "neg"),
+ Self::_DoNotUse(infallible) => match infallible {},
}
}
}
@@ -326,8 +326,8 @@ impl fmt::Display for MathOp {
impl<'a, T: Arbitrary<'a>> Arbitrary<'a> for NumOpResult<T> {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
match bool::arbitrary(u)? {
- true => Ok(NumOpResult::Valid(T::arbitrary(u)?)),
- false => Ok(NumOpResult::Error(NumOpError(MathOp::arbitrary(u)?))),
+ true => Ok(Self::Valid(T::arbitrary(u)?)),
+ false => Ok(Self::Error(NumOpError(MathOp::arbitrary(u)?))),
}
}
}
@@ -337,12 +337,12 @@ impl<'a> Arbitrary<'a> for MathOp {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let choice = u.int_in_range(0..=5)?;
match choice {
- 0 => Ok(MathOp::Add),
- 1 => Ok(MathOp::Sub),
- 2 => Ok(MathOp::Mul),
- 3 => Ok(MathOp::Div),
- 4 => Ok(MathOp::Rem),
- _ => Ok(MathOp::Neg),
+ 0 => Ok(Self::Add),
+ 1 => Ok(Self::Sub),
+ 2 => Ok(Self::Mul),
+ 3 => Ok(Self::Div),
+ 4 => Ok(Self::Rem),
+ _ => Ok(Self::Neg),
}
}
}
diff --git a/units/src/sequence.rs b/units/src/sequence.rs
index 51f01d0e..3c903ed3 100644
--- a/units/src/sequence.rs
+++ b/units/src/sequence.rs
@@ -38,25 +38,25 @@ impl Sequence {
/// The maximum allowable sequence number.
///
/// The sequence number that disables replace-by-fee, absolute lock time and relative lock time.
- pub const MAX: Self = Sequence(0xFFFF_FFFF);
+ pub const MAX: Self = Self(0xFFFF_FFFF);
/// Zero value sequence.
///
/// This sequence number enables replace-by-fee and absolute lock time.
- pub const ZERO: Self = Sequence(0);
+ pub const ZERO: Self = Self(0);
/// The sequence number that disables replace-by-fee, absolute lock time and relative lock time.
- pub const FINAL: Self = Sequence::MAX;
+ pub const FINAL: Self = Self::MAX;
/// The sequence number that enables absolute lock time but disables replace-by-fee
/// and relative lock time.
- pub const ENABLE_LOCKTIME_NO_RBF: Self = Sequence::MIN_NO_RBF;
+ pub const ENABLE_LOCKTIME_NO_RBF: Self = Self::MIN_NO_RBF;
/// The sequence number that enables replace-by-fee and absolute lock time but
/// disables relative lock time.
#[deprecated(since = "TBD", note = "use `ENABLE_LOCKTIME_AND_RBF` instead")]
- pub const ENABLE_RBF_NO_LOCKTIME: Self = Sequence(0xFFFF_FFFD);
+ pub const ENABLE_RBF_NO_LOCKTIME: Self = Self(0xFFFF_FFFD);
/// The maximum sequence number that enables replace-by-fee and absolute lock time but
/// disables relative lock time.
///
/// This sequence number has no meaning other than to enable RBF and the absolute locktime.
- pub const ENABLE_LOCKTIME_AND_RBF: Self = Sequence(0xFFFF_FFFD);
+ pub const ENABLE_LOCKTIME_AND_RBF: Self = Self(0xFFFF_FFFD);
/// The number of bytes that a sequence number contributes to the size of a transaction.
pub const SIZE: usize = 4; // Serialized length of a u32.
@@ -68,7 +68,7 @@ impl Sequence {
/// (Explicit Signalling [BIP-0125]).
///
/// [BIP-0125]: <https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki>
- const MIN_NO_RBF: Self = Sequence(0xFFFF_FFFE);
+ const MIN_NO_RBF: Self = Self(0xFFFF_FFFE);
/// BIP-0068 relative lock time disable flag mask.
const LOCK_TIME_DISABLE_FLAG_MASK: u32 = 0x8000_0000;
/// BIP-0068 relative lock time type flag mask.
@@ -76,7 +76,7 @@ impl Sequence {
/// Returns `true` if the sequence number enables absolute lock-time (`Transaction::lock_time`).
#[inline]
- pub fn enables_absolute_lock_time(self) -> bool { self != Sequence::MAX }
+ pub fn enables_absolute_lock_time(self) -> bool { self != Self::MAX }
/// Returns `true` if the sequence number indicates that the transaction is finalized.
///
@@ -105,24 +105,24 @@ impl Sequence {
/// Replace by fee is signaled by the sequence being less than 0xfffffffe which is checked by
/// this method. Note, this is the highest "non-final" value (see [`Sequence::is_final`]).
#[inline]
- pub fn is_rbf(self) -> bool { self < Sequence::MIN_NO_RBF }
+ pub fn is_rbf(self) -> bool { self < Self::MIN_NO_RBF }
/// Returns `true` if the sequence has a relative lock-time.
#[inline]
pub fn is_relative_lock_time(self) -> bool {
- self.0 & Sequence::LOCK_TIME_DISABLE_FLAG_MASK == 0
+ self.0 & Self::LOCK_TIME_DISABLE_FLAG_MASK == 0
}
/// Returns `true` if the sequence number encodes a block based relative lock-time.
#[inline]
pub fn is_height_locked(self) -> bool {
- self.is_relative_lock_time() & (self.0 & Sequence::LOCK_TYPE_MASK == 0)
+ self.is_relative_lock_time() & (self.0 & Self::LOCK_TYPE_MASK == 0)
}
/// Returns `true` if the sequence number encodes a time interval based relative lock-time.
#[inline]
pub fn is_time_locked(self) -> bool {
- self.is_relative_lock_time() & (self.0 & Sequence::LOCK_TYPE_MASK > 0)
+ self.is_relative_lock_time() & (self.0 & Self::LOCK_TYPE_MASK > 0)
}
/// Constructs a new `Sequence` from a prefixed hex string.
@@ -151,7 +151,7 @@ impl Sequence {
/// Constructs a new relative lock-time using block height.
#[inline]
- pub fn from_height(height: u16) -> Self { Sequence(u32::from(height)) }
+ pub fn from_height(height: u16) -> Self { Self(u32::from(height)) }
/// Constructs a new relative lock-time using time intervals where each interval is equivalent
/// to 512 seconds.
@@ -159,7 +159,7 @@ impl Sequence {
/// Encoding finer granularity of time for relative lock-times is not supported in Bitcoin
#[inline]
pub fn from_512_second_intervals(intervals: u16) -> Self {
- Sequence(u32::from(intervals) | Sequence::LOCK_TYPE_MASK)
+ Self(u32::from(intervals) | Self::LOCK_TYPE_MASK)
}
/// Constructs a new relative lock-time from seconds, converting the seconds into 512 second
@@ -174,7 +174,7 @@ impl Sequence {
#[inline]
pub fn from_seconds_floor(seconds: u32) -> Result<Self, TimeOverflowError> {
let intervals = NumberOf512Seconds::from_seconds_floor(seconds)?;
- Ok(Sequence::from_512_second_intervals(intervals.to_512_second_intervals()))
+ Ok(Self::from_512_second_intervals(intervals.to_512_second_intervals()))
}
/// Constructs a new relative lock-time from seconds, converting the seconds into 512 second
@@ -189,12 +189,12 @@ impl Sequence {
#[inline]
pub fn from_seconds_ceil(seconds: u32) -> Result<Self, TimeOverflowError> {
let intervals = NumberOf512Seconds::from_seconds_ceil(seconds)?;
- Ok(Sequence::from_512_second_intervals(intervals.to_512_second_intervals()))
+ Ok(Self::from_512_second_intervals(intervals.to_512_second_intervals()))
}
/// Constructs a new sequence from a u32 value.
#[inline]
- pub fn from_consensus(n: u32) -> Self { Sequence(n) }
+ pub fn from_consensus(n: u32) -> Self { Self(n) }
/// Returns the inner 32bit integer value of Sequence.
#[inline]
@@ -234,12 +234,12 @@ impl Sequence {
impl Default for Sequence {
/// The default value of sequence is 0xffffffff.
#[inline]
- fn default() -> Self { Sequence::MAX }
+ fn default() -> Self { Self::MAX }
}
impl From<Sequence> for u32 {
#[inline]
- fn from(sequence: Sequence) -> u32 { sequence.0 }
+ fn from(sequence: Sequence) -> Self { sequence.0 }
}
impl fmt::Display for Sequence {
@@ -354,21 +354,21 @@ impl<'a> Arbitrary<'a> for Sequence {
// Equally weight the cases of meaningful sequence numbers
let choice = u.int_in_range(0..=8)?;
match choice {
- 0 => Ok(Sequence::MAX),
- 1 => Ok(Sequence::ZERO),
- 2 => Ok(Sequence::MIN_NO_RBF),
- 3 => Ok(Sequence::ENABLE_LOCKTIME_AND_RBF),
- 4 => Ok(Sequence::from_consensus(u32::from(relative::NumberOfBlocks::MIN.to_height()))),
- 5 => Ok(Sequence::from_consensus(u32::from(relative::NumberOfBlocks::MAX.to_height()))),
- 6 => Ok(Sequence::from_consensus(
- Sequence::LOCK_TYPE_MASK
+ 0 => Ok(Self::MAX),
+ 1 => Ok(Self::ZERO),
+ 2 => Ok(Self::MIN_NO_RBF),
+ 3 => Ok(Self::ENABLE_LOCKTIME_AND_RBF),
+ 4 => Ok(Self::from_consensus(u32::from(relative::NumberOfBlocks::MIN.to_height()))),
+ 5 => Ok(Self::from_consensus(u32::from(relative::NumberOfBlocks::MAX.to_height()))),
+ 6 => Ok(Self::from_consensus(
+ Self::LOCK_TYPE_MASK
| u32::from(relative::NumberOf512Seconds::MIN.to_512_second_intervals()),
)),
- 7 => Ok(Sequence::from_consensus(
- Sequence::LOCK_TYPE_MASK
+ 7 => Ok(Self::from_consensus(
+ Self::LOCK_TYPE_MASK
| u32::from(relative::NumberOf512Seconds::MAX.to_512_second_intervals()),
)),
- _ => Ok(Sequence(u.arbitrary()?)),
+ _ => Ok(Self(u.arbitrary()?)),
}
}
}
diff --git a/units/src/time.rs b/units/src/time.rs
index 5a6850a8..59410415 100644
--- a/units/src/time.rs
+++ b/units/src/time.rs
@@ -38,7 +38,7 @@ mod encapsulate {
impl BlockTime {
/// Constructs a new [`BlockTime`] from an unsigned 32 bit integer value.
#[inline]
- pub const fn from_u32(t: u32) -> Self { BlockTime(t) }
+ pub const fn from_u32(t: u32) -> Self { Self(t) }
/// Returns the inner `u32` value.
#[inline]
@@ -162,7 +162,7 @@ impl<'a> Arbitrary<'a> for BlockTime {
#[inline]
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let t: u32 = u.arbitrary()?;
- Ok(BlockTime::from(t))
+ Ok(Self::from(t))
}
}
diff --git a/units/src/weight.rs b/units/src/weight.rs
index 95a6018b..0a3a2d90 100644
--- a/units/src/weight.rs
+++ b/units/src/weight.rs
@@ -25,7 +25,7 @@ mod encapsulate {
impl Weight {
/// Constructs a new [`Weight`] from weight units.
- pub const fn from_wu(wu: u64) -> Self { Weight(wu) }
+ pub const fn from_wu(wu: u64) -> Self { Self(wu) }
/// Returns raw weight units.
///
@@ -40,30 +40,30 @@ impl Weight {
/// Zero weight units (wu).
///
/// Equivalent to [`MIN`](Self::MIN), may better express intent in some contexts.
- pub const ZERO: Weight = Weight::from_wu(0);
+ pub const ZERO: Self = Self::from_wu(0);
/// Minimum possible value (0 wu).
///
/// Equivalent to [`ZERO`](Self::ZERO), may better express intent in some contexts.
- pub const MIN: Weight = Weight::from_wu(u64::MIN);
+ pub const MIN: Self = Self::from_wu(u64::MIN);
/// Maximum possible value.
- pub const MAX: Weight = Weight::from_wu(u64::MAX);
+ pub const MAX: Self = Self::from_wu(u64::MAX);
/// The factor that non-witness serialization data is multiplied by during weight calculation.
pub const WITNESS_SCALE_FACTOR: u64 = WITNESS_SCALE_FACTOR as u64; // this value is 4
/// The maximum allowed weight for a block, see BIP-0141 (network rule).
- pub const MAX_BLOCK: Weight = Weight::from_wu(4_000_000);
+ pub const MAX_BLOCK: Self = Self::from_wu(4_000_000);
/// The minimum transaction weight for a valid serialized transaction.
- pub const MIN_TRANSACTION: Weight = Weight::from_wu(Self::WITNESS_SCALE_FACTOR * 60);
+ pub const MIN_TRANSACTION: Self = Self::from_wu(Self::WITNESS_SCALE_FACTOR * 60);
/// Constructs a new [`Weight`] from kilo weight units returning [`None`] if an overflow occurred.
pub const fn from_kwu(wu: u64) -> Option<Self> {
// No `map()` in const context.
match wu.checked_mul(1000) {
- Some(wu) => Some(Weight::from_wu(wu)),
+ Some(wu) => Some(Self::from_wu(wu)),
None => None,
}
}
@@ -72,7 +72,7 @@ impl Weight {
pub const fn from_vb(vb: u64) -> Option<Self> {
// No `map()` in const context.
match vb.checked_mul(Self::WITNESS_SCALE_FACTOR) {
- Some(wu) => Some(Weight::from_wu(wu)),
+ Some(wu) => Some(Self::from_wu(wu)),
None => None,
}
}
@@ -83,21 +83,21 @@ impl Weight {
///
/// If the conversion from virtual bytes overflows.
#[deprecated(since = "TBD", note = "use `from_vb_unchecked` instead")]
- pub const fn from_vb_unwrap(vb: u64) -> Weight {
+ pub const fn from_vb_unwrap(vb: u64) -> Self {
match vb.checked_mul(Self::WITNESS_SCALE_FACTOR) {
- Some(weight) => Weight::from_wu(weight),
+ Some(weight) => Self::from_wu(weight),
None => panic!("checked_mul overflowed"),
}
}
/// Constructs a new [`Weight`] from virtual bytes without an overflow check.
pub const fn from_vb_unchecked(vb: u64) -> Self {
- Weight::from_wu(vb * Self::WITNESS_SCALE_FACTOR)
+ Self::from_wu(vb * Self::WITNESS_SCALE_FACTOR)
}
/// Constructs a new [`Weight`] from witness size.
#[deprecated(since = "TBD", note = "use `from_wu` instead")]
- pub const fn from_witness_data_size(witness_size: u64) -> Self { Weight::from_wu(witness_size) }
+ pub const fn from_witness_data_size(witness_size: u64) -> Self { Self::from_wu(witness_size) }
/// Constructs a new [`Weight`] from non-witness size.
///
@@ -106,7 +106,7 @@ impl Weight {
/// If the conversion from virtual bytes overflows.
#[deprecated(since = "TBD", note = "use `from_vb` or `from_vb_unchecked` instead")]
pub const fn from_non_witness_data_size(non_witness_size: u64) -> Self {
- Weight::from_wu(non_witness_size * Self::WITNESS_SCALE_FACTOR)
+ Self::from_wu(non_witness_size * Self::WITNESS_SCALE_FACTOR)
}
/// Converts to kilo weight units rounding down.
@@ -128,7 +128,7 @@ impl Weight {
pub const fn checked_add(self, rhs: Self) -> Option<Self> {
// No `map()` in const context.
match self.to_wu().checked_add(rhs.to_wu()) {
- Some(wu) => Some(Weight::from_wu(wu)),
+ Some(wu) => Some(Self::from_wu(wu)),
None => None,
}
}
@@ -140,7 +140,7 @@ impl Weight {
pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
// No `map()` in const context.
match self.to_wu().checked_sub(rhs.to_wu()) {
- Some(wu) => Some(Weight::from_wu(wu)),
+ Some(wu) => Some(Self::from_wu(wu)),
None => None,
}
}
@@ -152,7 +152,7 @@ impl Weight {
pub const fn checked_mul(self, rhs: u64) -> Option<Self> {
// No `map()` in const context.
match self.to_wu().checked_mul(rhs) {
- Some(wu) => Some(Weight::from_wu(wu)),
+ Some(wu) => Some(Self::from_wu(wu)),
None => None,
}
}
@@ -164,7 +164,7 @@ impl Weight {
pub const fn checked_div(self, rhs: u64) -> Option<Self> {
// No `map()` in const context.
match self.to_wu().checked_div(rhs) {
- Some(wu) => Some(Weight::from_wu(wu)),
+ Some(wu) => Some(Self::from_wu(wu)),
None => None,
}
}
@@ -246,15 +246,15 @@ crate::internal_macros::impl_add_assign!(Weight);
crate::internal_macros::impl_sub_assign!(Weight);
impl ops::MulAssign<u64> for Weight {
- fn mul_assign(&mut self, rhs: u64) { *self = Weight::from_wu(self.to_wu() * rhs); }
+ fn mul_assign(&mut self, rhs: u64) { *self = Self::from_wu(self.to_wu() * rhs); }
}
impl ops::DivAssign<u64> for Weight {
- fn div_assign(&mut self, rhs: u64) { *self = Weight::from_wu(self.to_wu() / rhs); }
+ fn div_assign(&mut self, rhs: u64) { *self = Self::from_wu(self.to_wu() / rhs); }
}
impl ops::RemAssign<u64> for Weight {
- fn rem_assign(&mut self, rhs: u64) { *self = Weight::from_wu(self.to_wu() % rhs); }
+ fn rem_assign(&mut self, rhs: u64) { *self = Self::from_wu(self.to_wu() % rhs); }
}
impl core::iter::Sum for Weight {
@@ -262,14 +262,14 @@ impl core::iter::Sum for Weight {
where
I: Iterator<Item = Self>,
{
- Weight::from_wu(iter.map(Weight::to_wu).sum())
+ Self::from_wu(iter.map(Self::to_wu).sum())
}
}
-impl<'a> core::iter::Sum<&'a Weight> for Weight {
+impl<'a> core::iter::Sum<&'a Self> for Weight {
fn sum<I>(iter: I) -> Self
where
- I: Iterator<Item = &'a Weight>,
+ I: Iterator<Item = &'a Self>,
{
iter.copied().sum()
}
@@ -303,7 +303,7 @@ impl<'de> Deserialize<'de> for Weight {
impl<'a> Arbitrary<'a> for Weight {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let w = u64::arbitrary(u)?;
- Ok(Weight::from_wu(w))
+ Ok(Self::from_wu(w))
}
}
diff --git a/units/tests/api.rs b/units/tests/api.rs
index 32274c00..68fc495c 100644
--- a/units/tests/api.rs
+++ b/units/tests/api.rs
@@ -306,7 +306,7 @@ fn dyn_compatible() {
#[cfg(feature = "arbitrary")]
impl<'a> Arbitrary<'a> for Types {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
- let a = Types { a: Enums::arbitrary(u)?, b: Structs::arbitrary(u)? };
+ let a = Self { a: Enums::arbitrary(u)?, b: Structs::arbitrary(u)? };
Ok(a)
}
}
@@ -314,7 +314,7 @@ impl<'a> Arbitrary<'a> for Types {
#[cfg(feature = "arbitrary")]
impl<'a> Arbitrary<'a> for Structs {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
- let a = Structs {
+ let a = Self {
a: Amount::arbitrary(u)?,
// Skip the `Display` type.
b: Amount::MAX.display_in(amount::Denomination::Bitcoin),
@@ -338,7 +338,7 @@ impl<'a> Arbitrary<'a> for Structs {
#[cfg(feature = "arbitrary")]
impl<'a> Arbitrary<'a> for Enums {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
- let a = Enums {
+ let a = Self {
a: amount::Denomination::arbitrary(u)?,
b: NumOpResult::<Amount>::arbitrary(u)?,
c: result::MathOp::arbitrary(u)?,
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.