mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Rename bytes to hex, allocate String with capacity.
This commit is contained in:
parent
ae01996066
commit
d338206a62
1 changed files with 6 additions and 4 deletions
|
@ -322,10 +322,12 @@ fn determine_regex(lines: &[String]) -> Option<(Regex, bool)> {
|
|||
|
||||
// Converts bytes to a hexadecimal string
|
||||
fn bytes_to_hex(bytes: &[u8]) -> String {
|
||||
bytes.iter().fold(String::new(), |mut bytes, byte| {
|
||||
write!(bytes, "{byte:02x}").unwrap();
|
||||
bytes
|
||||
})
|
||||
bytes
|
||||
.iter()
|
||||
.fold(String::with_capacity(bytes.len() * 2), |mut hex, byte| {
|
||||
write!(hex, "{byte:02x}").unwrap();
|
||||
hex
|
||||
})
|
||||
}
|
||||
|
||||
fn get_expected_checksum(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue