primitives: drop redundant reference in format! calls
What changed, and why it matters
This commit only cleans up test code by removing unnecessary '&' symbols inside format!() calls. It does not change any runtime behavior or fix a security issue.
No security action needed; this is a routine code-quality cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies primitives/src/transaction.rs test assertions, changing format! macros from passing references (e.g., format!(“{:?}”, &outpoint)) to passing values directly (e.g., format!(“{:?}”, outpoint)). format! automatically takes references when needed, so this is a pure style/refactoring change with no functional or security impact.
Changed components
primitives/src/transaction.rsInspect captured patch +6 / −6
diff --git a/primitives/src/transaction.rs b/primitives/src/transaction.rs
index 8fd0819e..5a22ed14 100644
--- a/primitives/src/transaction.rs
+++ b/primitives/src/transaction.rs
@@ -1907,10 +1907,10 @@ mod tests {
let outpoint = OutPoint::COINBASE_PREVOUT;
let debug = "OutPoint { txid: Txid(bitcoin_hashes::sha256d::Hash(0000000000000000000000000000000000000000000000000000000000000000)), vout: 4294967295 }";
- assert_eq!(debug, format!("{:?}", &outpoint));
+ assert_eq!(debug, format!("{:?}", outpoint));
let display = "0000000000000000000000000000000000000000000000000000000000000000:4294967295";
- assert_eq!(display, format!("{}", &outpoint));
+ assert_eq!(display, format!("{}", outpoint));
let pretty_debug = "OutPoint {
txid: Txid(
@@ -1920,16 +1920,16 @@ mod tests {
),
vout: 4294967295,
}";
- assert_eq!(pretty_debug, format!("{:#?}", &outpoint));
+ assert_eq!(pretty_debug, format!("{:#?}", outpoint));
let debug_txid = "Txid(bitcoin_hashes::sha256d::Hash(0000000000000000000000000000000000000000000000000000000000000000))";
- assert_eq!(debug_txid, format!("{:?}", &outpoint.txid));
+ assert_eq!(debug_txid, format!("{:?}", outpoint.txid));
let display_txid = "0000000000000000000000000000000000000000000000000000000000000000";
- assert_eq!(display_txid, format!("{}", &outpoint.txid));
+ assert_eq!(display_txid, format!("{}", outpoint.txid));
let pretty_txid = "0x0000000000000000000000000000000000000000000000000000000000000000";
- assert_eq!(pretty_txid, format!("{:#}", &outpoint.txid));
+ assert_eq!(pretty_txid, format!("{:#}", outpoint.txid));
}
#[test]
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.