Skip to content

Commit

Permalink
Fix use of format in async code
Browse files Browse the repository at this point in the history
  • Loading branch information
ollipa committed Jan 27, 2024
1 parent 628448f commit fbcc8ed
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/asynchronous.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
use std::collections::HashMap;
use std::fmt::Write;
use std::io::Cursor;

use log::debug;
use neli::consts::nl::Nlmsg;
use neli::consts::socket::NlFamily;
Expand All @@ -6,8 +10,6 @@ use neli::nl::NlPayload;
use neli::router::asynchronous::{NlRouter, NlRouterReceiverHandle};
use neli::utils::Groups;
use neli::ToBytes;
use std::collections::HashMap;
use std::io::Cursor;

use crate::attributes::{Attribute, Attrs, MonitorFlags};
use crate::error::Result;
Expand Down Expand Up @@ -164,7 +166,10 @@ impl AsyncNlSocket {
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 fbcc8ed

Please sign in to comment.