From 5f7a5bb89e3a7f33aaaaae83c8aa8c23bfcfde62 Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Mon, 13 Nov 2023 10:41:03 -0800 Subject: [PATCH] virtio-devices: Fix beta clippy issue error: use of a fallible conversion when an infallible one could be used Error: --> virtio-devices/src/vhost_user/vu_common_ctrl.rs:206:51 | 206 | let actual_size: usize = queue.size().try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^ help: use: `into()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions = note: `-D clippy::unnecessary-fallible-conversions` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_fallible_conversions)]` error: could not compile `virtio-devices` (lib) due to previous error Error: warning: build failed, waiting for other jobs to finish... error: could not compile `virtio-devices` (lib test) due to previous error Error: The process '/home/runner/.cargo/bin/cargo' failed with exit code 101 Signed-off-by: Bo Chen --- virtio-devices/src/vhost_user/vu_common_ctrl.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/virtio-devices/src/vhost_user/vu_common_ctrl.rs b/virtio-devices/src/vhost_user/vu_common_ctrl.rs index 6875daf4a9..6f980f23da 100644 --- a/virtio-devices/src/vhost_user/vu_common_ctrl.rs +++ b/virtio-devices/src/vhost_user/vu_common_ctrl.rs @@ -7,7 +7,6 @@ use crate::{ get_host_address_range, GuestMemoryMmap, GuestRegionMmap, MmapRegion, VirtioInterrupt, VirtioInterruptType, }; -use std::convert::TryInto; use std::ffi; use std::fs::File; use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; @@ -203,7 +202,7 @@ impl VhostUserHandle { let mut vrings_info = Vec::new(); for (queue_index, queue, queue_evt) in queues.iter() { - let actual_size: usize = queue.size().try_into().unwrap(); + let actual_size: usize = queue.size().into(); let config_data = VringConfigData { queue_max_size: queue.max_size(),