What changed, and why it matters
This commit is a routine code cleanup that runs the Clippy linter. It only changes how error messages are formatted in two Rust files—switching from older format!() argument styles to newer inline variable syntax. There is no functional change, no bug fix, and no security relevance.
No action required. This is a non-functional linting/style cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies formatting-only changes in rust/keystore/src/algorithms/ed25519/slip10_ed25519.rs and rust/keystore/src/algorithms/rsa/mod.rs. In slip10_ed25519.rs, a format!() call is replaced with .to_string(). In rsa/mod.rs, seed.len(), p.len(), and q.len() are captured into local variables so they can be referenced inline in format strings. These are idiomatic Clippy-driven refactorings with no behavioral or security impact.
Changed components
rust/keystore/src/algorithms/ed25519/slip10_ed25519.rsrust/keystore/src/algorithms/rsa/mod.rsInspect captured patch +11 / −13
diff --git a/rust/keystore/src/algorithms/ed25519/slip10_ed25519.rs b/rust/keystore/src/algorithms/ed25519/slip10_ed25519.rs
index 4b6ef0b..5edfc73 100644
--- a/rust/keystore/src/algorithms/ed25519/slip10_ed25519.rs
+++ b/rust/keystore/src/algorithms/ed25519/slip10_ed25519.rs
@@ -134,9 +134,9 @@ pub fn sign_message_by_seed(seed: &[u8], path: &String, message: &[u8]) -> Resul
///
fn get_master_key_by_seed(seed: &[u8]) -> Result<[u8; 64]> {
if seed.len() < 16 {
- return Err(KeystoreError::SeedError(format!(
- "seed must be at least 16 bytes"
- )));
+ return Err(KeystoreError::SeedError(
+ "seed must be at least 16 bytes".to_string(),
+ ));
}
Ok(hmac_sha512(b"ed25519 seed", seed))
}
diff --git a/rust/keystore/src/algorithms/rsa/mod.rs b/rust/keystore/src/algorithms/rsa/mod.rs
index fd8cb24..1f062da 100644
--- a/rust/keystore/src/algorithms/rsa/mod.rs
+++ b/rust/keystore/src/algorithms/rsa/mod.rs
@@ -34,10 +34,10 @@ fn get_rsa_seed(seed: &[u8]) -> Result<[u8; 32]> {
pub fn get_rsa_secret_from_seed(seed: &[u8]) -> Result<RsaPrivateKey> {
// bip39 seed length is 64, slip39 seed length is 16 or 32
+ let seed_len = seed.len();
if !matches!(seed.len(), 16 | 32 | 64) {
return Err(KeystoreError::GenerateSigningKeyError(format!(
- "Invalid seed length: {}, expected 16, 32, or 64 bytes",
- seed.len()
+ "Invalid seed length: {seed_len}, expected 16, 32, or 64 bytes"
)));
}
let mut rsa_seed = get_rsa_seed(seed)?;
@@ -82,19 +82,17 @@ pub fn sign_message(
}
pub fn build_rsa_private_key_from_primes(p: &[u8], q: &[u8]) -> Result<RsaPrivateKey> {
- if p.len() != PRIME_LENGTH_IN_BYTE {
+ let p_len = p.len();
+ let q_len = q.len();
+ if p_len != PRIME_LENGTH_IN_BYTE {
return Err(KeystoreError::GenerateSigningKeyError(format!(
- "Invalid prime P length: {}, expected {} bytes",
- p.len(),
- PRIME_LENGTH_IN_BYTE
+ "Invalid prime P length: {p_len}, expected {PRIME_LENGTH_IN_BYTE} bytes"
)));
}
- if q.len() != PRIME_LENGTH_IN_BYTE {
+ if q_len != PRIME_LENGTH_IN_BYTE {
return Err(KeystoreError::GenerateSigningKeyError(format!(
- "Invalid prime Q length: {}, expected {} bytes",
- q.len(),
- PRIME_LENGTH_IN_BYTE
+ "Invalid prime Q length: {q_len}, expected {PRIME_LENGTH_IN_BYTE} bytes",
)));
}
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.