From b027edffe7c38d2bbdf48daa103ddc60cb457485 Mon Sep 17 00:00:00 2001 From: Martin Habovstiak Date: Sun, 11 Aug 2024 15:31:10 +0200 Subject: [PATCH] Wrap `Script` impl blocks in temporary modules `rustfmt` is unable to format macro calls so instead we wrap the impl blocks in modules to enable formatting in the next commit. We need to change the visibility of the methods but that's OK since they're internal. --- bitcoin/src/blockdata/script/borrowed.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bitcoin/src/blockdata/script/borrowed.rs b/bitcoin/src/blockdata/script/borrowed.rs index 358d08972..936d61441 100644 --- a/bitcoin/src/blockdata/script/borrowed.rs +++ b/bitcoin/src/blockdata/script/borrowed.rs @@ -135,6 +135,8 @@ impl Script { } } +mod tmp_pub { + use super::*; impl Script { /// Returns an iterator over script bytes. #[inline] @@ -502,9 +504,12 @@ impl Script { self.as_bytes().first().copied().map(From::from) } } +} +mod tmp_priv { + use super::*; impl Script { - fn minimal_non_dust_internal(&self, dust_relay_fee: u64) -> crate::Amount { + pub(crate) fn minimal_non_dust_internal(&self, dust_relay_fee: u64) -> crate::Amount { // This must never be lower than Bitcoin Core's GetDustThreshold() (as of v0.21) as it may // otherwise allow users to create transactions which likely can never be broadcast/confirmed. let sats = dust_relay_fee @@ -527,7 +532,7 @@ impl Script { crate::Amount::from_sat(sats) } - fn count_sigops_internal(&self, accurate: bool) -> usize { + pub(crate) fn count_sigops_internal(&self, accurate: bool) -> usize { let mut n = 0; let mut pushnum_cache = None; for inst in self.instructions() { @@ -590,6 +595,7 @@ impl Script { } } } +} /// Iterator over bytes of a script pub struct Bytes<'a>(core::iter::Copied>);