Skip to content

Commit ae97384

Browse files
Fmt Botgithub-actions[bot]
authored andcommitted
2026-03-01 automated rustfmt nightly
1 parent f71c02c commit ae97384

5 files changed

Lines changed: 23 additions & 27 deletions

File tree

bitcoin/src/merkle_tree/block.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,12 @@ impl<'a> Arbitrary<'a> for MerkleBlock {
530530

531531
#[cfg(test)]
532532
mod tests {
533-
use hex::{DisplayHex, FromHex};
534-
use hex_lit::hex;
535533
#[cfg(feature = "std")]
536534
use core::cmp;
537535

536+
use hex::{DisplayHex, FromHex};
537+
use hex_lit::hex;
538+
538539
use super::*;
539540
use crate::block::Unchecked;
540541
use crate::consensus::encode;
@@ -555,11 +556,7 @@ mod tests {
555556
const P: usize = 1039;
556557
const Q: usize = 677;
557558

558-
const fn new(seed: usize) -> Self {
559-
Self {
560-
state: seed
561-
}
562-
}
559+
const fn new(seed: usize) -> Self { Self { state: seed } }
563560

564561
#[inline]
565562
fn next_usize(&mut self) -> usize {
@@ -568,14 +565,10 @@ mod tests {
568565
}
569566

570567
#[inline]
571-
fn next_in_range(&mut self, max: usize) -> usize {
572-
self.next_usize() % max
573-
}
568+
fn next_in_range(&mut self, max: usize) -> usize { self.next_usize() % max }
574569

575570
#[inline]
576-
fn next_u8(&mut self) -> u8 {
577-
self.next_usize().to_le_bytes()[0]
578-
}
571+
fn next_u8(&mut self) -> u8 { self.next_usize().to_le_bytes()[0] }
579572
}
580573

581574
#[cfg(feature = "std")]

consensus_encoding/src/decode/decoders.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ impl Decoder for ByteVecDecoder {
7878
type Error = ByteVecDecoderError;
7979

8080
fn push_bytes(&mut self, bytes: &mut &[u8]) -> Result<bool, Self::Error> {
81-
use {ByteVecDecoderError as E, ByteVecDecoderErrorInner as Inner};
81+
use ByteVecDecoderError as E;
82+
use ByteVecDecoderErrorInner as Inner;
8283

8384
if let Some(mut decoder) = self.prefix_decoder.take() {
8485
if decoder.push_bytes(bytes).map_err(|e| E(Inner::LengthPrefixDecode(e)))? {
@@ -106,7 +107,8 @@ impl Decoder for ByteVecDecoder {
106107
}
107108

108109
fn end(self) -> Result<Self::Output, Self::Error> {
109-
use {ByteVecDecoderError as E, ByteVecDecoderErrorInner as Inner};
110+
use ByteVecDecoderError as E;
111+
use ByteVecDecoderErrorInner as Inner;
110112

111113
if let Some(ref prefix_decoder) = self.prefix_decoder {
112114
return Err(E(Inner::UnexpectedEof(UnexpectedEofError {
@@ -189,7 +191,8 @@ impl<T: Decodable> Decoder for VecDecoder<T> {
189191
type Error = VecDecoderError<<<T as Decodable>::Decoder as Decoder>::Error>;
190192

191193
fn push_bytes(&mut self, bytes: &mut &[u8]) -> Result<bool, Self::Error> {
192-
use {VecDecoderError as E, VecDecoderErrorInner as Inner};
194+
use VecDecoderError as E;
195+
use VecDecoderErrorInner as Inner;
193196

194197
if let Some(mut decoder) = self.prefix_decoder.take() {
195198
if decoder.push_bytes(bytes).map_err(|e| E(Inner::LengthPrefixDecode(e)))? {

network/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ pub mod as_core_arg {
197197
#![allow(clippy::missing_errors_doc)]
198198

199199
use crate::Network;
200-
200+
201201
#[allow(clippy::trivially_copy_pass_by_ref)] // `serde` controls the API.
202202
pub fn serialize<S>(network: &Network, serializer: S) -> Result<S::Ok, S::Error>
203203
where

primitives/src/transaction.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,9 @@ impl Decoder for TransactionDecoder {
449449

450450
#[inline]
451451
fn push_bytes(&mut self, bytes: &mut &[u8]) -> Result<bool, Self::Error> {
452-
use {
453-
TransactionDecoderError as E, TransactionDecoderErrorInner as Inner,
454-
TransactionDecoderState as State,
455-
};
452+
use TransactionDecoderError as E;
453+
use TransactionDecoderErrorInner as Inner;
454+
use TransactionDecoderState as State;
456455

457456
loop {
458457
// Attempt to push to the currently-active decoder and return early on success.
@@ -575,10 +574,9 @@ impl Decoder for TransactionDecoder {
575574

576575
#[inline]
577576
fn end(self) -> Result<Self::Output, Self::Error> {
578-
use {
579-
TransactionDecoderError as E, TransactionDecoderErrorInner as Inner,
580-
TransactionDecoderState as State,
581-
};
577+
use TransactionDecoderError as E;
578+
use TransactionDecoderErrorInner as Inner;
579+
use TransactionDecoderState as State;
582580

583581
match self.state {
584582
State::Version(_) => Err(E(Inner::EarlyEnd("version"))),

primitives/src/witness.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ impl Decoder for WitnessDecoder {
337337
type Error = WitnessDecoderError;
338338

339339
fn push_bytes(&mut self, bytes: &mut &[u8]) -> Result<bool, Self::Error> {
340-
use {WitnessDecoderError as E, WitnessDecoderErrorInner as Inner};
340+
use WitnessDecoderError as E;
341+
use WitnessDecoderErrorInner as Inner;
341342

342343
// Read initial witness element count.
343344
if self.witness_elements.is_none() {
@@ -445,7 +446,8 @@ impl Decoder for WitnessDecoder {
445446
}
446447

447448
fn end(mut self) -> Result<Self::Output, Self::Error> {
448-
use {WitnessDecoderError as E, WitnessDecoderErrorInner as Inner};
449+
use WitnessDecoderError as E;
450+
use WitnessDecoderErrorInner as Inner;
449451

450452
let Some(witness_elements) = self.witness_elements else {
451453
// Never read the witness element count.

0 commit comments

Comments
 (0)