2024-09-22 automated rustfmt nightly

This commit is contained in:
Fmt Bot 2024-09-22 01:20:08 +00:00 committed by github-actions[bot]
parent f804e0027b
commit 2009763ae5
4 changed files with 10 additions and 13 deletions

View File

@ -1412,21 +1412,18 @@ impl InputWeightPrediction {
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
impl<'a> Arbitrary<'a> for OutPoint { impl<'a> Arbitrary<'a> for OutPoint {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> { fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
Ok(OutPoint{ Ok(OutPoint { txid: Txid::arbitrary(u)?, vout: u32::arbitrary(u)? })
txid: Txid::arbitrary(u)?,
vout: u32::arbitrary(u)?
})
} }
} }
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
impl<'a> Arbitrary<'a> for TxIn { impl<'a> Arbitrary<'a> for TxIn {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> { fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
Ok(TxIn{ Ok(TxIn {
previous_output: OutPoint::arbitrary(u)?, previous_output: OutPoint::arbitrary(u)?,
script_sig: ScriptBuf::arbitrary(u)?, script_sig: ScriptBuf::arbitrary(u)?,
sequence: Sequence::arbitrary(u)?, sequence: Sequence::arbitrary(u)?,
witness: Witness::arbitrary(u)? witness: Witness::arbitrary(u)?,
}) })
} }
} }
@ -1440,7 +1437,7 @@ impl<'a> Arbitrary<'a> for Transaction {
version: Version::arbitrary(u)?, version: Version::arbitrary(u)?,
lock_time: LockTime::arbitrary(u)?, lock_time: LockTime::arbitrary(u)?,
input: Vec::<TxIn>::arbitrary(u)?, input: Vec::<TxIn>::arbitrary(u)?,
output: Vec::<TxOut>::arbitrary(u)? output: Vec::<TxOut>::arbitrary(u)?,
}) })
} }
} }

View File

@ -7,6 +7,8 @@
use core::fmt; use core::fmt;
use core::ops::Index; use core::ops::Index;
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
use internals::compact_size; use internals::compact_size;
use io::{BufRead, Write}; use io::{BufRead, Write};
@ -18,8 +20,6 @@ use crate::prelude::Vec;
use crate::script::ScriptExt as _; use crate::script::ScriptExt as _;
use crate::taproot::{self, TAPROOT_ANNEX_PREFIX}; use crate::taproot::{self, TAPROOT_ANNEX_PREFIX};
use crate::{Script, VarInt}; use crate::{Script, VarInt};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
/// The Witness is the data used to unlock bitcoin since the [segwit upgrade]. /// The Witness is the data used to unlock bitcoin since the [segwit upgrade].
/// ///
@ -623,7 +623,7 @@ impl Default for Witness {
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
impl<'a> Arbitrary<'a> for Witness { impl<'a> Arbitrary<'a> for Witness {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> { fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let arbitrary_bytes = Vec::<Vec::<u8>>::arbitrary(u)?; let arbitrary_bytes = Vec::<Vec<u8>>::arbitrary(u)?;
Ok(Witness::from_slice(&arbitrary_bytes)) Ok(Witness::from_slice(&arbitrary_bytes))
} }
} }

View File

@ -17,6 +17,8 @@
use core::fmt; use core::fmt;
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
use internals::impl_to_hex_from_lower_hex; use internals::impl_to_hex_from_lower_hex;
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -24,8 +26,6 @@ use serde::{Deserialize, Serialize};
use units::locktime::relative::TimeOverflowError; use units::locktime::relative::TimeOverflowError;
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
use units::parse::{self, PrefixedHexError, UnprefixedHexError}; use units::parse::{self, PrefixedHexError, UnprefixedHexError};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
use crate::locktime::relative; use crate::locktime::relative;

View File

@ -12,9 +12,9 @@
use core::fmt; use core::fmt;
use hashes::sha256d;
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured}; use arbitrary::{Arbitrary, Unstructured};
use hashes::sha256d;
hashes::hash_newtype! { hashes::hash_newtype! {
/// A bitcoin transaction hash/transaction ID. /// A bitcoin transaction hash/transaction ID.