can: run clippy --fix

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
This commit is contained in:
Manos Pitsidianakis 2025-07-08 11:22:28 +03:00 committed by Stefano Garzarella
parent f77506a809
commit e36857d2b4
4 changed files with 16 additions and 19 deletions

View File

@ -112,7 +112,7 @@ pub(crate) fn start_backend_server(socket: PathBuf, can_devs: String) -> Result<
// Wait for read thread to exit
match read_handle.join() {
Ok(_) => info!("The read thread returned successfully"),
Err(e) => warn!("The read thread returned the error: {:?}", e),
Err(e) => warn!("The read thread returned the error: {e:?}"),
}
}
}
@ -128,12 +128,9 @@ pub fn start_backend(config: VuCanConfig) -> Result<()> {
.map(|(a, b)| (a, b.to_string()))
.enumerate()
{
println!(
"thread_id: {}, socket: {:?}, can_devs: {:?}",
thread_id, socket, can_devs,
);
println!("thread_id: {thread_id}, socket: {socket:?}, can_devs: {can_devs:?}",);
let name = format!("vhu-can-{}", can_devs);
let name = format!("vhu-can-{can_devs}");
let sender = senders.clone();
let handle = thread::Builder::new()
.name(name.clone())

View File

@ -64,7 +64,7 @@ impl CanController {
// Creates a new controller corresponding to `device`.
pub(crate) fn new(can_name: String) -> Result<CanController> {
let can_name = can_name.to_owned();
info!("can_name: {:?}", can_name);
info!("can_name: {can_name:?}");
let rx_fifo = Queue::new();
let rx_efd = EventFd::new(EFD_NONBLOCK).map_err(|_| Error::EventFdFailed)?;
@ -93,10 +93,10 @@ impl CanController {
let last_elem = canframe.length.to_native() as usize - 1;
for (index, sdu) in canframe.sdu.iter().enumerate() {
if index == last_elem {
trace!("0x{:x}", sdu);
trace!("0x{sdu:x}");
break;
}
trace!("0x{:x}, ", sdu);
trace!("0x{sdu:x}, ");
}
trace!("]");
}
@ -198,19 +198,19 @@ impl CanController {
// Match and process frame variants
let read_can_frame = match frame {
CanAnyFrame::Normal(frame) => {
trace!("Received CAN frame: {:?}", frame);
trace!("Received CAN frame: {frame:?}");
Self::process_frame(frame, false)
}
CanAnyFrame::Fd(frame) => {
trace!("Received CAN FD frame: {:?}", frame);
trace!("Received CAN FD frame: {frame:?}");
Self::process_frame(frame, true)
}
CanAnyFrame::Remote(frame) => {
trace!("Received Remote CAN frame: {:?}", frame);
trace!("Received Remote CAN frame: {frame:?}");
Self::process_frame(frame, false)
}
CanAnyFrame::Error(frame) => {
trace!("Received Error frame: {:?}", frame);
trace!("Received Error frame: {frame:?}");
Self::process_frame(frame, false)
}
};
@ -354,7 +354,7 @@ mod tests {
let operation_result = controller.can_out(frame);
assert!(operation_result.is_ok());
}
Err(_) => warn!("There is no CAN interface with {} name", can_name),
Err(_) => warn!("There is no CAN interface with {can_name} name"),
}
}

View File

@ -40,7 +40,7 @@ struct CanArgs {
fn check_can_devices(can_devices: &[String]) -> Result<()> {
for can_dev in can_devices {
if CanSocket::open(can_dev).is_err() {
info!("There is no interface with the following name {}", can_dev);
info!("There is no interface with the following name {can_dev}");
return Err(Error::CouldNotFindCANDevs);
}
}

View File

@ -94,7 +94,7 @@ pub(crate) enum Error {
impl convert::From<Error> for io::Error {
fn from(e: Error) -> Self {
io::Error::new(io::ErrorKind::Other, e)
io::Error::other(e)
}
}
@ -130,7 +130,7 @@ impl VhostUserCanBackend {
let mut flags = 0;
if msg_type != VIRTIO_CAN_TX {
warn!("TX: Message type 0x{:x} unknown\n", msg_type);
warn!("TX: Message type 0x{msg_type:x} unknown\n");
return Err(Error::UnexpectedCanMsgType(msg_type));
}
@ -435,7 +435,7 @@ impl VhostUserCanBackend {
}
}
Err(e) => {
warn!("The tx frame had the following error: {}", e);
warn!("The tx frame had the following error: {e}");
VIRTIO_CAN_RESULT_NOT_OK
}
};
@ -506,7 +506,7 @@ impl VhostUserCanBackend {
let can_rx = match self.check_rx_frame(response) {
Ok(frame) => frame,
Err(e) => {
warn!("The tx frame had the following error: {}", e);
warn!("The tx frame had the following error: {e}");
return Err(e);
}
};