Use "a".repeats() instead of manual implementation

Clippy emits:

  warning: manual implementation of `str::repeat` using iterators

As suggested, use `"a".repeats()`.
This commit is contained in:
Tobin C. Harding 2022-06-10 12:52:17 +10:00
parent 42de876e01
commit 685444c342
2 changed files with 2 additions and 2 deletions

View File

@ -1875,7 +1875,7 @@ mod test {
assert!(PublicKey::from_str("0218845781f631c48f1c9709e23092067d06837f30aa0cd0544ac887fe91ddd1").is_err());
assert!(PublicKey::from_str("xx0218845781f631c48f1c9709e23092067d06837f30aa0cd0544ac887fe91ddd1").is_err());
let long_str: String = core::iter::repeat('a').take(1024 * 1024).collect();
let long_str = "a".repeat(1024 * 1024);
assert!(SecretKey::from_str(&long_str).is_err());
assert!(PublicKey::from_str(&long_str).is_err());
}

View File

@ -505,7 +505,7 @@ mod tests {
)
.is_err());
let long_str: String = core::iter::repeat('a').take(1024 * 1024).collect();
let long_str: String = "a".repeat(1024 * 1024);
assert!(XOnlyPublicKey::from_str(&long_str).is_err());
}