Skip to content

Commit f85d75b

Browse files
Fmt Botgithub-actions[bot]
authored andcommitted
2025-11-09 automated rustfmt nightly
1 parent 70588cc commit f85d75b

File tree

28 files changed

+269
-250
lines changed

28 files changed

+269
-250
lines changed

base58/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ extern crate std;
2424

2525
static BASE58_CHARS: &[u8] = b"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
2626

27-
use core::{fmt, iter, slice, str};
2827
#[cfg(not(feature = "std"))]
2928
pub use alloc::{string::String, vec::Vec};
29+
use core::{fmt, iter, slice, str};
3030
#[cfg(feature = "std")]
3131
pub use std::{string::String, vec::Vec};
3232

bitcoin/src/address/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl std::error::Error for FromScriptError {
6767
}
6868

6969
impl From<witness_program::Error> for FromScriptError {
70-
fn from(e : witness_program::Error) -> Self { Self::WitnessProgram(e) }
70+
fn from(e: witness_program::Error) -> Self { Self::WitnessProgram(e) }
7171
}
7272

7373
impl From<witness_version::TryFromError> for FromScriptError {

bitcoin/src/address/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use bech32::primitives::hrp::Hrp;
3636
use hashes::{sha256, Hash, HashEngine};
3737
use secp256k1::{Secp256k1, Verification, XOnlyPublicKey};
3838

39+
use self::error::P2shError;
3940
use crate::blockdata::constants::{
4041
MAX_SCRIPT_ELEMENT_SIZE, PUBKEY_ADDRESS_PREFIX_MAIN, PUBKEY_ADDRESS_PREFIX_TEST,
4142
SCRIPT_ADDRESS_PREFIX_MAIN, SCRIPT_ADDRESS_PREFIX_TEST,
@@ -49,8 +50,6 @@ use crate::crypto::key::{
4950
use crate::network::{Network, NetworkKind};
5051
use crate::prelude::*;
5152
use crate::taproot::TapNodeHash;
52-
53-
use self::error::P2shError;
5453
#[rustfmt::skip] // Keep public re-exports separate.
5554
#[doc(inline)]
5655
pub use self::{

bitcoin/src/bip152.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,7 @@ mod test {
377377
use crate::blockdata::locktime::absolute;
378378
use crate::blockdata::transaction;
379379
use crate::consensus::encode::{deserialize, serialize};
380-
use crate::{
381-
Amount, CompactTarget, OutPoint, ScriptBuf, Sequence, TxIn, TxOut, Txid,
382-
Witness,
383-
};
380+
use crate::{Amount, CompactTarget, OutPoint, ScriptBuf, Sequence, TxIn, TxOut, Txid, Witness};
384381

385382
fn dummy_tx(nonce: &[u8]) -> Transaction {
386383
Transaction {

bitcoin/src/bip32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use secp256k1::{Secp256k1, XOnlyPublicKey};
1717

1818
use crate::crypto::key::{CompressedPublicKey, Keypair, PrivateKey};
1919
use crate::internal_macros::impl_bytes_newtype;
20-
use crate::prelude::*;
2120
use crate::network::NetworkKind;
21+
use crate::prelude::*;
2222

2323
/// Version bytes for extended public keys on the Bitcoin network.
2424
const VERSION_BYTES_MAINNET_PUBLIC: [u8; 4] = [0x04, 0x88, 0xB2, 0x1E];

bitcoin/src/blockdata/locktime/absolute.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,13 @@ impl ParseError {
755755
move |source| Self::InvalidInteger { source, input: s.into() }
756756
}
757757

758-
fn display(&self, f: &mut fmt::Formatter<'_>, subject: &str, lower_bound: u32, upper_bound: u32) -> fmt::Result {
758+
fn display(
759+
&self,
760+
f: &mut fmt::Formatter<'_>,
761+
subject: &str,
762+
lower_bound: u32,
763+
upper_bound: u32,
764+
) -> fmt::Result {
759765
use core::num::IntErrorKind;
760766

761767
use ParseError::*;

bitcoin/src/blockdata/script/owned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use crate::blockdata::script::{
1616
use crate::key::{
1717
PubkeyHash, PublicKey, TapTweak, TweakedPublicKey, UntweakedPublicKey, WPubkeyHash,
1818
};
19-
use crate::taproot::TapNodeHash;
2019
use crate::prelude::*;
20+
use crate::taproot::TapNodeHash;
2121

2222
/// An owned, growable script.
2323
///

bitcoin/src/blockdata/transaction.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ use crate::blockdata::FeeRate;
2626
use crate::consensus::{encode, Decodable, Encodable};
2727
use crate::internal_macros::{impl_consensus_encoding, impl_hashencode};
2828
use crate::parse::impl_parse_str_from_int_infallible;
29+
use crate::prelude::*;
2930
#[cfg(doc)]
3031
use crate::sighash::{EcdsaSighashType, TapSighashType};
3132
use crate::string::FromHexStr;
32-
use crate::prelude::*;
3333
use crate::{Amount, SignedAmount, VarInt};
3434

3535
#[rustfmt::skip] // Keep public re-exports separate.
@@ -809,7 +809,7 @@ impl Transaction {
809809
#[inline]
810810
pub fn total_size(&self) -> usize {
811811
let mut size: usize = 4; // Serialized length of a u32 for the version number.
812-
let uses_segwit = self.uses_segwit_serialization();
812+
let uses_segwit = self.uses_segwit_serialization();
813813

814814
if uses_segwit {
815815
size += 2; // 1 byte for the marker and 1 for the flag.
@@ -819,13 +819,7 @@ impl Transaction {
819819
size += self
820820
.input
821821
.iter()
822-
.map(|input| {
823-
if uses_segwit {
824-
input.total_size()
825-
} else {
826-
input.base_size()
827-
}
828-
})
822+
.map(|input| if uses_segwit { input.total_size() } else { input.base_size() })
829823
.sum::<usize>();
830824

831825
size += VarInt::from(self.output.len()).size();
@@ -1780,10 +1774,7 @@ mod tests {
17801774
let tx_bytes = hex!("0000fd000001021921212121212121212121f8b372b0239cc1dff600000000004f4f4f4f4f4f4f4f000000000000000000000000000000333732343133380d000000000000000000000000000000ff000000000009000dff000000000000000800000000000000000d");
17811775
let tx: Result<Transaction, _> = deserialize(&tx_bytes);
17821776
assert!(tx.is_err());
1783-
assert!(tx
1784-
.unwrap_err()
1785-
.to_string()
1786-
.contains("witness flag set but no witnesses present"));
1777+
assert!(tx.unwrap_err().to_string().contains("witness flag set but no witnesses present"));
17871778
}
17881779

17891780
#[test]

bitcoin/src/blockdata/witness.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use io::{BufRead, Write};
1313
use crate::consensus::encode::{Error, MAX_VEC_SIZE};
1414
use crate::consensus::{Decodable, Encodable, WriteExt};
1515
use crate::crypto::ecdsa;
16-
use crate::taproot::{self, TAPROOT_ANNEX_PREFIX};
1716
use crate::prelude::*;
17+
use crate::taproot::{self, TAPROOT_ANNEX_PREFIX};
1818
use crate::{Script, VarInt};
1919

2020
/// The Witness is the data used to unlock bitcoin since the [segwit upgrade].
@@ -235,11 +235,7 @@ impl Witness {
235235
/// Creates a new empty [`Witness`].
236236
#[inline]
237237
pub const fn new() -> Self {
238-
Witness {
239-
content: Vec::new(),
240-
witness_elements: 0,
241-
indices_start: 0,
242-
}
238+
Witness { content: Vec::new(), witness_elements: 0, indices_start: 0 }
243239
}
244240

245241
/// Creates a witness required to spend a P2WPKH output.
@@ -556,7 +552,7 @@ impl Default for Witness {
556552

557553
#[cfg(test)]
558554
mod test {
559-
use hex::{test_hex_unwrap as hex};
555+
use hex::test_hex_unwrap as hex;
560556

561557
use super::*;
562558
use crate::consensus::{deserialize, serialize};

bitcoin/src/consensus/encode.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use core::{fmt, mem, u32};
1919

2020
use hashes::{sha256, sha256d, Hash};
2121
use internals::write_err;
22-
use io::{Cursor, BufRead, Read, Write};
22+
use io::{BufRead, Cursor, Read, Write};
2323

2424
use crate::bip152::{PrefilledTransaction, ShortId};
2525
use crate::bip158::{FilterHash, FilterHeader};
@@ -356,13 +356,18 @@ macro_rules! impl_int_encodable {
356356
($ty:ident, $meth_dec:ident, $meth_enc:ident) => {
357357
impl Decodable for $ty {
358358
#[inline]
359-
fn consensus_decode<R: BufRead + ?Sized>(r: &mut R) -> core::result::Result<Self, Error> {
359+
fn consensus_decode<R: BufRead + ?Sized>(
360+
r: &mut R,
361+
) -> core::result::Result<Self, Error> {
360362
ReadExt::$meth_dec(r)
361363
}
362364
}
363365
impl Encodable for $ty {
364366
#[inline]
365-
fn consensus_encode<W: Write + ?Sized>(&self, w: &mut W) -> core::result::Result<usize, io::Error> {
367+
fn consensus_encode<W: Write + ?Sized>(
368+
&self,
369+
w: &mut W,
370+
) -> core::result::Result<usize, io::Error> {
366371
w.$meth_enc(*self)?;
367372
Ok(mem::size_of::<$ty>())
368373
}
@@ -538,7 +543,9 @@ macro_rules! impl_array {
538543

539544
impl Decodable for [u8; $size] {
540545
#[inline]
541-
fn consensus_decode<R: BufRead + ?Sized>(r: &mut R) -> core::result::Result<Self, Error> {
546+
fn consensus_decode<R: BufRead + ?Sized>(
547+
r: &mut R,
548+
) -> core::result::Result<Self, Error> {
542549
let mut ret = [0; $size];
543550
r.read_slice(&mut ret)?;
544551
Ok(ret)
@@ -582,7 +589,10 @@ macro_rules! impl_vec {
582589
($type: ty) => {
583590
impl Encodable for Vec<$type> {
584591
#[inline]
585-
fn consensus_encode<W: Write + ?Sized>(&self, w: &mut W) -> core::result::Result<usize, io::Error> {
592+
fn consensus_encode<W: Write + ?Sized>(
593+
&self,
594+
w: &mut W,
595+
) -> core::result::Result<usize, io::Error> {
586596
let mut len = 0;
587597
len += VarInt(self.len() as u64).consensus_encode(w)?;
588598
for c in self.iter() {

0 commit comments

Comments
 (0)