refactor(mimefactory): use iter::repeat_with instead of (0..)

This commit is contained in:
Alexander Krotov
2019-12-20 14:14:51 +03:00
committed by holger krekel
parent 01df2e2dc7
commit 980bb35441

View File

@@ -1010,8 +1010,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
fn wrapped_base64_encode(buf: &[u8]) -> String {
let base64 = base64::encode(&buf);
let mut chars = base64.chars();
(0..)
.map(|_| chars.by_ref().take(78).collect::<String>())
std::iter::repeat_with(|| chars.by_ref().take(78).collect::<String>())
.take_while(|s| !s.is_empty())
.collect::<Vec<_>>()
.join("\r\n")