Merge rust-bitcoin/rust-bitcoin#3685: Automated nightly rustfmt (2024-12-01)

0990b30035 2024-12-01 automated rustfmt nightly (Fmt Bot)

Pull request description:

  Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  apoelstra:
    ACK 0990b30035a01e6e75aa5e82412d79bd1eb9e267; successfully ran local tests

Tree-SHA512: 56e2f0de98868d4ce958764924a6a0f7c245ffa8c7898638b7d316b5b56d4fd2c9f5e01fe5e3da5ebcec44d135d44fdf99be5d912a7b1dbd93da8a6b1d82b14d
This commit is contained in:
merge-script 2024-12-01 03:42:09 +00:00
commit a4ad864370
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
5 changed files with 15 additions and 26 deletions

View File

@ -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]);

View File

@ -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,
};
}

View File

@ -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")]

View File

@ -331,15 +331,11 @@ impl std::error::Error for PrefixedHexError {
}
impl From<MissingPrefixError> for PrefixedHexError {
fn from(e: MissingPrefixError) -> Self {
Self(PrefixedHexErrorInner::MissingPrefix(e))
}
fn from(e: MissingPrefixError) -> Self { Self(PrefixedHexErrorInner::MissingPrefix(e)) }
}
impl From<ParseIntError> 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<ContainsPrefixError> for UnprefixedHexError {
fn from(e: ContainsPrefixError) -> Self {
Self(UnprefixedHexErrorInner::ContainsPrefix(e))
}
fn from(e: ContainsPrefixError) -> Self { Self(UnprefixedHexErrorInner::ContainsPrefix(e)) }
}
impl From<ParseIntError> 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`).

View File

@ -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]