Skip to content

Commit

Permalink
Fix use of format to build string from iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
ollipa committed Jan 27, 2024
1 parent 0f700ce commit 628448f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/synchronous.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::fmt::Write;
use std::io::Cursor;

use log::debug;
Expand Down Expand Up @@ -164,7 +165,10 @@ impl NlSocket {
if cfg!(debug_assertions) {
let mut b: Cursor<Vec<u8>> = Cursor::new(Vec::new());
request.nl_payload.to_bytes(&mut b).unwrap();
let octets: String = b.get_ref().iter().map(|v| format!("{:02x} ", v)).collect();
let octets: String = b.get_ref().iter().fold(String::new(), |mut output, b| {
let _ = write!(output, "{b:02x} ");
output
});
debug!("[PAYLOAD] {octets}");
}
self.socket
Expand Down

0 comments on commit 628448f

Please sign in to comment.