vsock: run clippy --fix

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
This commit is contained in:
Manos Pitsidianakis 2025-07-08 11:28:19 +03:00 committed by Stefano Garzarella
parent 27535e3ffd
commit 46c8f93d87
5 changed files with 17 additions and 20 deletions

View File

@ -483,7 +483,7 @@ fn main() {
let configs = match Vec::<VsockConfig>::try_from(VsockArgs::parse()) {
Ok(c) => c,
Err(e) => {
println!("Error parsing arguments: {}", e);
println!("Error parsing arguments: {e}");
return;
}
};

View File

@ -341,10 +341,7 @@ impl VsockThreadBackend {
.unwrap()
.is_disjoint(sibling_groups_set.read().unwrap().deref())
{
info!(
"vsock: dropping packet for cid: {:?} due to group mismatch",
dst_cid
);
info!("vsock: dropping packet for cid: {dst_cid:?} due to group mismatch");
return Ok(());
}
@ -354,7 +351,7 @@ impl VsockThreadBackend {
.push_back(RawVsockPacket::from_vsock_packet(pkt)?);
let _ = sibling_event_fd.write(1);
} else {
warn!("vsock: dropping packet for unknown cid: {:?}", dst_cid);
warn!("vsock: dropping packet for unknown cid: {dst_cid:?}");
}
return Ok(());

View File

@ -2,7 +2,7 @@
use std::{
collections::{HashMap, HashSet},
io::{self, Result as IoResult},
io::Result as IoResult,
path::PathBuf,
sync::{Arc, Mutex, RwLock},
};
@ -144,7 +144,7 @@ pub(crate) enum Error {
impl std::convert::From<Error> for std::io::Error {
fn from(e: Error) -> Self {
std::io::Error::new(io::ErrorKind::Other, e)
std::io::Error::other(e)
}
}

View File

@ -319,13 +319,13 @@ impl VhostUserVsockThread {
})
.and_then(|stream| self.add_stream_listener(stream))
.unwrap_or_else(|err| {
warn!("Unable to accept new local connection: {:?}", err);
warn!("Unable to accept new local connection: {err:?}");
});
} else {
// If we aren't ready to process requests, accept and immediately close
// the connection.
conn.map(drop).unwrap_or_else(|err| {
warn!("Error closing an incoming connection: {:?}", err);
warn!("Error closing an incoming connection: {err:?}");
});
}
}
@ -336,14 +336,14 @@ impl VhostUserVsockThread {
match conn {
Ok((stream, addr)) => {
if let Err(err) = stream.set_nonblocking(true) {
warn!("Failed to set stream to non-blocking: {:?}", err);
warn!("Failed to set stream to non-blocking: {err:?}");
return;
}
let peer_port = match vsock_listener.local_addr() {
Ok(listener_addr) => listener_addr.port(),
Err(err) => {
warn!("Failed to get peer address: {:?}", err);
warn!("Failed to get peer address: {err:?}");
return;
}
};
@ -361,16 +361,16 @@ impl VhostUserVsockThread {
stream_raw_fd,
epoll::Events::EPOLLIN | epoll::Events::EPOLLOUT,
) {
warn!("Failed to register with epoll: {:?}", err);
warn!("Failed to register with epoll: {err:?}");
}
}
Err(err) => {
warn!("Unable to accept new local connection: {:?}", err);
warn!("Unable to accept new local connection: {err:?}");
}
}
} else {
conn.map(drop).unwrap_or_else(|err| {
warn!("Error closing an incoming connection: {:?}", err);
warn!("Error closing an incoming connection: {err:?}");
});
}
}
@ -404,7 +404,7 @@ impl VhostUserVsockThread {
let peer_port = match Self::read_local_stream_port(unix_stream) {
Ok(port) => port,
Err(err) => {
warn!("Error while parsing \"connect PORT\n\" command: {:?}", err);
warn!("Error while parsing \"connect PORT\n\" command: {err:?}");
return;
}
};
@ -413,7 +413,7 @@ impl VhostUserVsockThread {
let local_port = match self.allocate_local_port() {
Ok(lp) => lp,
Err(err) => {
warn!("Error while allocating local port: {:?}", err);
warn!("Error while allocating local port: {err:?}");
return;
}
};
@ -617,7 +617,7 @@ impl VhostUserVsockThread {
}
}
Err(e) => {
warn!("vsock: RX queue error: {:?}", e);
warn!("vsock: RX queue error: {e:?}");
0
}
};

View File

@ -190,7 +190,7 @@ impl<S: AsRawFd + ReadVolatile + Write + WriteVolatile + IsHybridVsock> VsockCon
) {
// TODO: let's move this logic out of this func, and handle it
// properly
error!("epoll_register failed: {:?}, but proceed further.", e);
error!("epoll_register failed: {e:?}, but proceed further.");
}
};
}
@ -275,7 +275,7 @@ impl<S: AsRawFd + ReadVolatile + Write + WriteVolatile + IsHybridVsock> VsockCon
epoll::Events::EPOLLIN | epoll::Events::EPOLLOUT,
) {
// TODO: let's move this logic out of this func, and handle it properly
error!("epoll_register failed: {:?}, but proceed further.", e);
error!("epoll_register failed: {e:?}, but proceed further.");
}
};
}