From 0990b30035a01e6e75aa5e82412d79bd1eb9e267 Mon Sep 17 00:00:00 2001 From: Fmt Bot Date: Sun, 1 Dec 2024 01:41:12 +0000 Subject: [PATCH] 2024-12-01 automated rustfmt nightly --- bitcoin/src/blockdata/transaction.rs | 6 ++---- bitcoin/src/lib.rs | 4 ++-- bitcoin/src/psbt/mod.rs | 9 +++++---- units/src/parse.rs | 16 ++++------------ units/tests/api.rs | 6 ++---- 5 files changed, 15 insertions(+), 26 deletions(-) diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs index 137110f4f9..6a91bcc512 100644 --- a/bitcoin/src/blockdata/transaction.rs +++ b/bitcoin/src/blockdata/transaction.rs @@ -1133,9 +1133,7 @@ impl InputWeightPrediction { /// Computes the **signature weight** added to a transaction by an input with this weight prediction, /// not counting the prevout (txid, index), sequence, potential witness flag bytes or the witness count varint. #[deprecated(since = "TBD", note = "use `InputWeightPrediction::witness_weight()` instead")] - pub const fn weight(&self) -> Weight { - Self::witness_weight(self) - } + pub const fn weight(&self) -> Weight { Self::witness_weight(self) } /// Computes the signature, prevout (txid, index), and sequence weights of this weight /// prediction. @@ -1972,7 +1970,7 @@ mod tests { InputWeightPrediction::P2PKH_COMPRESSED_MAX, InputWeightPrediction::P2PKH_UNCOMPRESSED_MAX, InputWeightPrediction::P2TR_KEY_DEFAULT_SIGHASH, - InputWeightPrediction::P2TR_KEY_NON_DEFAULT_SIGHASH + InputWeightPrediction::P2TR_KEY_NON_DEFAULT_SIGHASH, ]; let weight = predict_weight_from_slices(&predict, &[1]); diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs index c17350b1ea..bb0e1f1c00 100644 --- a/bitcoin/src/lib.rs +++ b/bitcoin/src/lib.rs @@ -237,8 +237,8 @@ pub mod parse { #[doc(inline)] pub use units::parse::{ hex_check_unprefixed, hex_remove_prefix, hex_u128, hex_u128_unchecked, hex_u128_unprefixed, - hex_u32, hex_u32_unchecked, hex_u32_unprefixed, int, - ParseIntError, PrefixedHexError, UnprefixedHexError, + hex_u32, hex_u32_unchecked, hex_u32_unprefixed, int, ParseIntError, PrefixedHexError, + UnprefixedHexError, }; } diff --git a/bitcoin/src/psbt/mod.rs b/bitcoin/src/psbt/mod.rs index 7bf5791f0d..e1e64dde0c 100644 --- a/bitcoin/src/psbt/mod.rs +++ b/bitcoin/src/psbt/mod.rs @@ -256,8 +256,7 @@ impl Psbt { { continue; } else if derivation2.len() <= derivation1.len() - && derivation2[..] - == derivation1[derivation1.len() - derivation2.len()..] + && derivation2[..] == derivation1[derivation1.len() - derivation2.len()..] { entry.insert((fingerprint1, derivation1)); continue; @@ -2117,14 +2116,16 @@ mod tests { assert_eq!(psbt1, psbt2); } - // https://github.com/rust-bitcoin/rust-bitcoin/issues/3628 #[test] fn test_combine_psbt_fuzz_3628() { let mut psbt1 = hex_psbt(include_str!("../../tests/data/psbt_fuzz1.hex")).unwrap(); let psbt2 = hex_psbt(include_str!("../../tests/data/psbt_fuzz2.hex")).unwrap(); - assert!(matches!(psbt1.combine(psbt2).unwrap_err(), Error::CombineInconsistentKeySources(_))); + assert!(matches!( + psbt1.combine(psbt2).unwrap_err(), + Error::CombineInconsistentKeySources(_) + )); } #[cfg(feature = "rand-std")] diff --git a/units/src/parse.rs b/units/src/parse.rs index a78e6eb408..a08fd56923 100644 --- a/units/src/parse.rs +++ b/units/src/parse.rs @@ -331,15 +331,11 @@ impl std::error::Error for PrefixedHexError { } impl From for PrefixedHexError { - fn from(e: MissingPrefixError) -> Self { - Self(PrefixedHexErrorInner::MissingPrefix(e)) - } + fn from(e: MissingPrefixError) -> Self { Self(PrefixedHexErrorInner::MissingPrefix(e)) } } impl From for PrefixedHexError { - fn from(e: ParseIntError) -> Self { - Self(PrefixedHexErrorInner::ParseInt(e)) - } + fn from(e: ParseIntError) -> Self { Self(PrefixedHexErrorInner::ParseInt(e)) } } /// Error returned when parsing an integer from a hex string that is not supposed to contain a prefix. @@ -381,15 +377,11 @@ impl std::error::Error for UnprefixedHexError { } impl From for UnprefixedHexError { - fn from(e: ContainsPrefixError) -> Self { - Self(UnprefixedHexErrorInner::ContainsPrefix(e)) - } + fn from(e: ContainsPrefixError) -> Self { Self(UnprefixedHexErrorInner::ContainsPrefix(e)) } } impl From for UnprefixedHexError { - fn from(e: ParseIntError) -> Self { - Self(UnprefixedHexErrorInner::ParseInt(e)) - } + fn from(e: ParseIntError) -> Self { Self(UnprefixedHexErrorInner::ParseInt(e)) } } /// Error returned when a hex string is missing a prefix (e.g. `0x`). diff --git a/units/tests/api.rs b/units/tests/api.rs index 477cc825c9..8649e7397d 100644 --- a/units/tests/api.rs +++ b/units/tests/api.rs @@ -98,7 +98,7 @@ struct CommonTraits { } /// A struct that includes all types that implement `Default`. -#[derive(Default)] // C-COMMON-TRAITS: `Default` +#[derive(Default)] // C-COMMON-TRAITS: `Default` struct Default { a: Amount, b: SignedAmount, @@ -196,9 +196,7 @@ fn api_can_use_all_types_from_module_locktime_relative() { #[test] fn api_can_use_all_types_from_module_parse() { - use bitcoin_units::parse::{ - ParseIntError, PrefixedHexError, UnprefixedHexError, - }; + use bitcoin_units::parse::{ParseIntError, PrefixedHexError, UnprefixedHexError}; } #[test]