Apply new clippy lints

This commit is contained in:
cyqsimon
2025-07-10 11:05:17 +08:00
parent 2cbe503d44
commit cef3c44d1b
3 changed files with 3 additions and 3 deletions

View File

@@ -161,7 +161,7 @@ impl Sniffer {
}
pub fn reset_channel(&mut self) -> Result<()> {
self.network_frames = get_datalink_channel(&self.network_interface)
.map_err(|_| io::Error::new(io::ErrorKind::Other, "Interface not available"))?;
.map_err(|_| io::Error::other("Interface not available"))?;
Ok(())
}
fn handle_v6(ip_packet: Ipv6Packet, network_interface: &NetworkInterface) -> Option<Segment> {

View File

@@ -80,7 +80,7 @@ fn get_interface(interface_name: &str) -> Option<NetworkInterface> {
fn create_write_to_stdout() -> Box<dyn FnMut(&str) + Send> {
let mut stdout = io::stdout();
Box::new({
move |output| match writeln!(stdout, "{}", output) {
move |output| match writeln!(stdout, "{output}") {
Ok(_) => (),
Err(e) if e.kind() == ErrorKind::BrokenPipe => {
// A process that was listening to bandwhich stdout has exited

View File

@@ -261,7 +261,7 @@ pub fn os_input_output_factory(
Some(stdout) => Box::new({
move |output| {
let mut stdout = stdout.lock().unwrap();
writeln!(&mut stdout, "{}", output).unwrap();
writeln!(&mut stdout, "{output}").unwrap();
}
}),
None => Box::new(|_output| {}),