What changed, and why it matters
This is an automated code-formatting commit from rustfmt. It only changes whitespace, line breaks, and brace style in two source files. No program logic, behavior, or security properties were changed.
No action needed; this is a formatting-only change with no security relevance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit applies rustfmt nightly formatting: collapsing a one-line method body, converting match arms from braced blocks to trailing-expression style, and rewrapping long array literals in tests. The diff is purely stylistic; no semantic tokens were added, removed, or reordered, and no logic paths were altered.
Changed components
consensus_encoding/src/encode/encoders.rsprimitives/src/transaction.rsInspect captured patch +23 / −34
diff --git a/consensus_encoding/src/encode/encoders.rs b/consensus_encoding/src/encode/encoders.rs
index f5d2de1f..36831623 100644
--- a/consensus_encoding/src/encode/encoders.rs
+++ b/consensus_encoding/src/encode/encoders.rs
@@ -30,9 +30,7 @@ impl<'sl> BytesEncoder<'sl> {
}
impl Encoder for BytesEncoder<'_> {
- fn current_chunk(&self) -> &[u8] {
- self.sl.unwrap_or_default()
- }
+ fn current_chunk(&self) -> &[u8] { self.sl.unwrap_or_default() }
fn advance(&mut self) -> bool {
self.sl = None;
@@ -592,10 +590,7 @@ mod tests {
// 0xFF + u64
let mut e = CompactSizeEncoder::new(0x0000_F0F0_F0F0_F0E0u64);
- assert_eq!(
- e.current_chunk(),
- &[0xFF, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00][..]
- );
+ assert_eq!(e.current_chunk(), &[0xFF, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00][..]);
assert!(!e.advance());
assert!(e.current_chunk().is_empty());
}
diff --git a/primitives/src/transaction.rs b/primitives/src/transaction.rs
index 79717adb..cdd63923 100644
--- a/primitives/src/transaction.rs
+++ b/primitives/src/transaction.rs
@@ -393,32 +393,27 @@ impl Decoder for TransactionDecoder {
// Still more bytes required.
return Ok(true);
}
- },
- State::Inputs(_, _, decoder) => {
+ }
+ State::Inputs(_, _, decoder) =>
if decoder.push_bytes(bytes)? {
return Ok(true);
- }
- },
- State::SegwitFlag(_) => {
+ },
+ State::SegwitFlag(_) =>
if bytes.is_empty() {
return Ok(true);
- }
- },
- State::Outputs(_, _, _, decoder) => {
+ },
+ State::Outputs(_, _, _, decoder) =>
if decoder.push_bytes(bytes)? {
return Ok(true);
- }
- },
- State::Witnesses(_, _, _, _, decoder) => {
+ },
+ State::Witnesses(_, _, _, _, decoder) =>
if decoder.push_bytes(bytes)? {
return Ok(true);
- }
- },
- State::LockTime(_, _, _, decoder) => {
+ },
+ State::LockTime(_, _, _, decoder) =>
if decoder.push_bytes(bytes)? {
return Ok(true);
- }
- },
+ },
State::Done(..) => return Ok(false),
State::Errored => panic!("call to push_bytes() after decoder errored"),
}
@@ -1719,8 +1714,8 @@ mod tests {
assert_eq!(
encoder.current_chunk(),
&[
- 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
+ 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12,
+ 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
][..]
);
assert!(encoder.advance());
@@ -1766,8 +1761,8 @@ mod tests {
assert_eq!(
encoder.current_chunk(),
&[
- 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
+ 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12,
+ 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
][..]
);
assert!(encoder.advance());
@@ -1814,8 +1809,8 @@ mod tests {
assert_eq!(
encoder.current_chunk(),
&[
- 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
+ 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12,
+ 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
][..]
);
assert!(encoder.advance());
@@ -1881,10 +1876,9 @@ mod tests {
assert_eq!(
encoder.current_chunk(),
&[
- 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
+ 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12,
+ 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
][..]
-
);
assert!(encoder.advance());
assert_eq!(encoder.current_chunk(), &[1u8, 0, 0, 0][..]);
@@ -1998,8 +1992,8 @@ mod tests {
assert_eq!(
encoder.current_chunk(),
&[
- 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
+ 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12,
+ 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
][..]
);
assert!(encoder.advance());
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.