From ae01996066b228921a68c2b357a5ba47270a305d Mon Sep 17 00:00:00 2001 From: David Campbell Date: Wed, 25 Sep 2024 12:48:48 -0400 Subject: [PATCH] Fix clippy::format_collect. --- src/uucore/src/lib/features/checksum.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/uucore/src/lib/features/checksum.rs b/src/uucore/src/lib/features/checksum.rs index 06456c94f..1eb20397d 100644 --- a/src/uucore/src/lib/features/checksum.rs +++ b/src/uucore/src/lib/features/checksum.rs @@ -23,6 +23,7 @@ use crate::{ }, util_name, }; +use std::fmt::Write; use std::io::stdin; use std::io::BufRead; use thiserror::Error; @@ -321,10 +322,10 @@ fn determine_regex(lines: &[String]) -> Option<(Regex, bool)> { // Converts bytes to a hexadecimal string fn bytes_to_hex(bytes: &[u8]) -> String { - bytes - .iter() - .map(|byte| format!("{byte:02x}")) - .collect::() + bytes.iter().fold(String::new(), |mut bytes, byte| { + write!(bytes, "{byte:02x}").unwrap(); + bytes + }) } fn get_expected_checksum(