Change format_with to take self by value
What changed, and why it matters
This is a minor internal code cleanup in a Rust formatting helper. It changes one function from borrowing a small value to copying it, following a common Rust style suggestion. There is no security relevance.
No action needed. This is a non-security refactoring change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies ChildNumber::format_with in key_expression/src/bip32.rs to take self by value instead of by reference, and removes the corresponding dereference in the match expression. ChildNumber is a small Copy type, so this is a clippy-driven style/performance micro-optimization with no functional or API change. The function remains private and is only used as an internal wrapper for formatting trait implementations.
Changed components
key_expression/src/bip32.rsInspect captured patch +2 / −2
diff --git a/key_expression/src/bip32.rs b/key_expression/src/bip32.rs
index 369c6554..a13fb7df 100644
--- a/key_expression/src/bip32.rs
+++ b/key_expression/src/bip32.rs
@@ -224,7 +224,7 @@ impl ChildNumber {
///
/// Returns an error if writing to the formatter fails.
fn format_with<F>(
- &self,
+ self,
f: &mut fmt::Formatter,
format_fn: F,
hardened_alt_suffix: &str,
@@ -232,7 +232,7 @@ impl ChildNumber {
where
F: Fn(&u32, &mut fmt::Formatter) -> fmt::Result,
{
- match *self {
+ match self {
Self::Hardened { index } => {
format_fn(&index, f)?;
let alt = f.alternate();
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.