What changed, and why it matters
This commit only reformats source code using the Rust formatter (cargo fmt). It changes whitespace, line breaks, and import grouping but does not alter program logic, behavior, or any security checks. There is no security issue.
No action required; this is a non-functional formatting commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff consists entirely of rustfmt-style changes: collapsing match arms onto single lines, reformatting long lines, and grouping use statements with braces. No functional code, control flow, arithmetic, bounds checks, cryptographic operations, or error handling semantics were modified. The previous commit’s functional changes are not present in this diff.
Changed components
Inspect captured patch +18 / −39
diff --git a/bitcoin/src/address/error.rs b/bitcoin/src/address/error.rs
index 55620769..82290920 100644
--- a/bitcoin/src/address/error.rs
+++ b/bitcoin/src/address/error.rs
@@ -29,11 +29,9 @@ impl From<Infallible> for FromScriptError {
impl fmt::Display for FromScriptError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
- Self::WitnessVersion(ref e) =>
- write_err!(f, "witness version construction error"; e),
+ Self::WitnessVersion(ref e) => write_err!(f, "witness version construction error"; e),
Self::WitnessProgram(ref e) => write_err!(f, "witness program error"; e),
- Self::UnrecognizedScript =>
- write!(f, "script is not a p2pkh, p2sh or witness program"),
+ Self::UnrecognizedScript => write!(f, "script is not a p2pkh, p2sh or witness program"),
}
}
}
@@ -256,8 +254,7 @@ impl fmt::Display for Base58Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::ParseBase58(ref e) => write_err!(f, "legacy parsing error"; e),
- Self::LegacyAddressTooLong(ref e) =>
- write_err!(f, "legacy address length error"; e),
+ Self::LegacyAddressTooLong(ref e) => write_err!(f, "legacy address length error"; e),
Self::InvalidBase58PayloadLength(ref e) =>
write_err!(f, "legacy payload length error"; e),
Self::InvalidLegacyPrefix(ref e) => write_err!(f, "legacy prefix error"; e),
diff --git a/bitcoin/src/blockdata/script/witness_version.rs b/bitcoin/src/blockdata/script/witness_version.rs
index 5d271f3e..bc09c68c 100644
--- a/bitcoin/src/blockdata/script/witness_version.rs
+++ b/bitcoin/src/blockdata/script/witness_version.rs
@@ -209,8 +209,7 @@ impl fmt::Display for TryFromInstructionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::TryFrom(ref e) => write_err!(f, "opcode is not a valid witness version"; e),
- Self::DataPush =>
- write!(f, "non-zero data push opcode is not a valid witness version"),
+ Self::DataPush => write!(f, "non-zero data push opcode is not a valid witness version"),
}
}
}
diff --git a/bitcoin/src/crypto/sighash.rs b/bitcoin/src/crypto/sighash.rs
index b6458d25..26c43cce 100644
--- a/bitcoin/src/crypto/sighash.rs
+++ b/bitcoin/src/crypto/sighash.rs
@@ -311,10 +311,8 @@ impl From<Infallible> for PrevoutsIndexError {
impl fmt::Display for PrevoutsIndexError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
- Self::InvalidOneIndex =>
- write!(f, "invalid index when accessing a Prevouts::One kind"),
- Self::InvalidAllIndex =>
- write!(f, "invalid index when accessing a Prevouts::All kind"),
+ Self::InvalidOneIndex => write!(f, "invalid index when accessing a Prevouts::One kind"),
+ Self::InvalidAllIndex => write!(f, "invalid index when accessing a Prevouts::All kind"),
}
}
}
@@ -1284,8 +1282,7 @@ impl fmt::Display for P2wpkhError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Sighash(ref e) => write_err!(f, "error encoding SegWit v0 signing data"; e),
- Self::NotP2wpkhScript =>
- write!(f, "script is not a script pubkey for a p2wpkh output"),
+ Self::NotP2wpkhScript => write!(f, "script is not a script pubkey for a p2wpkh output"),
}
}
}
diff --git a/bitcoin/src/crypto/taproot.rs b/bitcoin/src/crypto/taproot.rs
index b7ca5d19..59c71260 100644
--- a/bitcoin/src/crypto/taproot.rs
+++ b/bitcoin/src/crypto/taproot.rs
@@ -105,8 +105,7 @@ impl fmt::Display for SigFromSliceError {
match self {
Self::SighashType(ref e) => write_err!(f, "sighash"; e),
Self::Secp256k1(ref e) => write_err!(f, "secp256k1"; e),
- Self::InvalidSignatureSize(sz) =>
- write!(f, "invalid Taproot signature size: {}", sz),
+ Self::InvalidSignatureSize(sz) => write!(f, "invalid Taproot signature size: {}", sz),
}
}
}
diff --git a/bitcoin/src/psbt/mod.rs b/bitcoin/src/psbt/mod.rs
index 5f2bf9df..5cd35a2f 100644
--- a/bitcoin/src/psbt/mod.rs
+++ b/bitcoin/src/psbt/mod.rs
@@ -1075,8 +1075,7 @@ impl fmt::Display for SignError {
Self::MissingRedeemScript => write!(f, "missing redeem script"),
Self::MissingSpendUtxo => write!(f, "missing spend utxo in PSBT"),
Self::MissingWitnessScript => write!(f, "missing witness script"),
- Self::MismatchedAlgoKey =>
- write!(f, "signing algorithm and key type does not match"),
+ Self::MismatchedAlgoKey => write!(f, "signing algorithm and key type does not match"),
Self::NotEcdsa => write!(f, "attempted to ECDSA sign a non-ECDSA input"),
Self::NotWpkh => write!(f, "the scriptPubkey is not a P2WPKH script"),
Self::SegwitV0Sighash(ref e) => write_err!(f, "SegWit v0 sighash"; e),
diff --git a/bitcoin/src/psbt/serialize.rs b/bitcoin/src/psbt/serialize.rs
index 819cfd91..8d68df88 100644
--- a/bitcoin/src/psbt/serialize.rs
+++ b/bitcoin/src/psbt/serialize.rs
@@ -305,8 +305,7 @@ impl Serialize for taproot::Signature {
impl Deserialize for taproot::Signature {
fn deserialize(bytes: &[u8]) -> Result<Self, Error> {
Self::from_slice(bytes).map_err(|e| match e {
- taproot::SigFromSliceError::SighashType(err) =>
- Error::NonStandardSighashType(err.0),
+ taproot::SigFromSliceError::SighashType(err) => Error::NonStandardSighashType(err.0),
taproot::SigFromSliceError::InvalidSignatureSize(_) =>
Error::InvalidTaprootSignature(e),
taproot::SigFromSliceError::Secp256k1(..) => Error::InvalidTaprootSignature(e),
diff --git a/bitcoin/src/sign_message.rs b/bitcoin/src/sign_message.rs
index 4af5cf99..08ba143a 100644
--- a/bitcoin/src/sign_message.rs
+++ b/bitcoin/src/sign_message.rs
@@ -66,8 +66,7 @@ mod message_signing {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Self::InvalidEncoding(ref e) => Some(e),
- Self::InvalidLength | Self::InvalidBase64 | Self::UnsupportedAddressType(_) =>
- None,
+ Self::InvalidLength | Self::InvalidBase64 | Self::UnsupportedAddressType(_) => None,
}
}
}
diff --git a/bitcoin/src/taproot/mod.rs b/bitcoin/src/taproot/mod.rs
index 3a282a6d..e8ca5f9d 100644
--- a/bitcoin/src/taproot/mod.rs
+++ b/bitcoin/src/taproot/mod.rs
@@ -1524,7 +1524,8 @@ impl fmt::Display for TaprootError {
match self {
Self::InvalidMerkleBranchSize(ref e) => write_err!(f, "invalid Merkle branch size"; e),
Self::InvalidMerkleTreeDepth(ref e) => write_err!(f, "invalid Merkle tree depth"; e),
- Self::InvalidTaprootLeafVersion(ref e) => write_err!(f, "invalid Taproot leaf version"; e),
+ Self::InvalidTaprootLeafVersion(ref e) =>
+ write_err!(f, "invalid Taproot leaf version"; e),
Self::InvalidControlBlockSize(ref e) => write_err!(f, "invalid control block size"; e),
Self::InvalidControlBlockHex(ref e) => write_err!(f, "invalid control block hex"; e),
Self::InvalidInternalKey(ref e) => write_err!(f, "invalid internal x-only key"; e),
diff --git a/units/src/amount/tests.rs b/units/src/amount/tests.rs
index 8c7a938c..f3f488ca 100644
--- a/units/src/amount/tests.rs
+++ b/units/src/amount/tests.rs
@@ -661,8 +661,7 @@ fn unsigned_signed_conversion() {
#[allow(clippy::inconsistent_digit_grouping)] // Group to show 100,000,000 sats per bitcoin.
#[allow(clippy::items_after_statements)] // Define functions where we use them.
fn from_str() {
- use super::ParseDenominationError;
- use super::ParseAmountError as E;
+ use super::{ParseAmountError as E, ParseDenominationError};
assert_eq!(
"x BTC".parse::<Amount>(),
@@ -711,10 +710,7 @@ fn from_str() {
assert_eq!(s.replace(' ', "").parse::<SignedAmount>(), expected);
}
- case(
- "5 BCH",
- Err(ParseDenominationError::Unknown(UnknownDenominationError("BCH".into()))),
- );
+ case("5 BCH", Err(ParseDenominationError::Unknown(UnknownDenominationError("BCH".into()))));
case("-1 BTC", Err(OutOfRangeError::negative()));
case("-0.0 BTC", Err(OutOfRangeError::negative()));
@@ -820,8 +816,7 @@ fn to_from_string_in() {
#[cfg(feature = "alloc")]
#[test]
fn to_string_with_denomination_from_str_roundtrip() {
- use super::ParseDenominationError;
- use super::Denomination as D;
+ use super::{Denomination as D, ParseDenominationError};
let amt = sat(42);
let denom = Amount::to_string_with_denomination;
@@ -834,17 +829,11 @@ fn to_string_with_denomination_from_str_roundtrip() {
assert_eq!(
"42 satoshi BTC".parse::<Amount>(),
- Err(
- ParseDenominationError::Unknown(UnknownDenominationError("satoshi BTC".into()))
- .into(),
- ),
+ Err(ParseDenominationError::Unknown(UnknownDenominationError("satoshi BTC".into())).into(),),
);
assert_eq!(
"-42 satoshi BTC".parse::<SignedAmount>(),
- Err(
- ParseDenominationError::Unknown(UnknownDenominationError("satoshi BTC".into()))
- .into(),
- ),
+ Err(ParseDenominationError::Unknown(UnknownDenominationError("satoshi BTC".into())).into(),),
);
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.