Fix stable clippy string repeat lint
What changed, and why it matters
This commit only changes three lines inside test code to use a different, clippy-preferred way of repeating a string. It does not touch any production logic, network handling, cryptography, or wallet code. There is no security relevance.
No action needed; this is a lint-driven test refactor with no security implications.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies three unit tests in lightning/src/util/macro_logger.rs, replacing core::iter::repeat(c).take(n).collect() with c.repeat(n) purely to satisfy stable clippy’s string_repeat lint. The behavior of the tests remains identical, and no runtime code is affected.
Changed components
lightning/src/util/macro_logger.rs (test code only)Inspect captured patch +3 / −3
diff --git a/lightning/src/util/macro_logger.rs b/lightning/src/util/macro_logger.rs
index 92f6d97..66b6720 100644
--- a/lightning/src/util/macro_logger.rs
+++ b/lightning/src/util/macro_logger.rs
@@ -267,7 +267,7 @@ mod tests {
#[test]
fn debug_msg_truncates_at_limit() {
- let s: String = core::iter::repeat('a').take(LOG_MSG_MAX_LEN + 100).collect();
+ let s = "a".repeat(LOG_MSG_MAX_LEN + 100);
let result = DebugMsg(&s).to_string();
// Should be exactly LOG_MSG_MAX_LEN 'a's followed by "..."
assert_eq!(result.len(), LOG_MSG_MAX_LEN + 3);
@@ -276,7 +276,7 @@ mod tests {
#[test]
fn debug_msg_no_truncation_at_exact_limit() {
- let s: String = core::iter::repeat('a').take(LOG_MSG_MAX_LEN).collect();
+ let s = "a".repeat(LOG_MSG_MAX_LEN);
let result = DebugMsg(&s).to_string();
assert_eq!(result.len(), LOG_MSG_MAX_LEN);
assert!(!result.ends_with("..."));
@@ -298,7 +298,7 @@ mod tests {
#[test]
fn debug_msg_multibyte_unicode() {
// Each emoji is multiple bytes but one character
- let s: String = core::iter::repeat('\u{1F600}').take(LOG_MSG_MAX_LEN + 10).collect();
+ let s = "\u{1F600}".repeat(LOG_MSG_MAX_LEN + 10);
let result = DebugMsg(&s).to_string();
let char_count: usize = result.chars().count();
// LOG_MSG_MAX_LEN emoji chars + 3 chars for "..."
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.