From 73e8fd4d725bd6024009dacee7431d8d620db4bf Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Mon, 29 Mar 2021 10:23:58 +0200 Subject: [PATCH] clippy: Fix codebase to compile with beta toolchain Fixes the current codebase so that every cargo clippy can be run with the beta toolchain without any error. Signed-off-by: Sebastien Boeuf --- arch/src/aarch64/gic/gicv3_its.rs | 9 +-------- arch/src/aarch64/gic/mod.rs | 4 ++-- tests/integration.rs | 2 +- vhost_user_backend/src/lib.rs | 10 +--------- vhost_user_block/src/lib.rs | 2 +- vhost_user_net/src/lib.rs | 9 +-------- vmm/src/device_manager.rs | 1 + 7 files changed, 8 insertions(+), 29 deletions(-) diff --git a/arch/src/aarch64/gic/gicv3_its.rs b/arch/src/aarch64/gic/gicv3_its.rs index 385da9340..4bec26f0a 100644 --- a/arch/src/aarch64/gic/gicv3_its.rs +++ b/arch/src/aarch64/gic/gicv3_its.rs @@ -3,7 +3,6 @@ pub mod kvm { use std::any::Any; - use std::convert::TryInto; use std::sync::Arc; use std::{boxed::Box, result}; type Result = result::Result; @@ -16,9 +15,6 @@ pub mod kvm { /// The hypervisor agnostic device device: Arc, - /// Vector holding values of GICR_TYPER for each vCPU - gicr_typers: Vec, - /// GIC device properties, to be used for setting up the fdt entry gic_properties: [u64; 4], @@ -74,9 +70,7 @@ pub mod kvm { self.vcpu_count } - fn set_gicr_typers(&mut self, gicr_typers: Vec) { - self.gicr_typers = gicr_typers; - } + fn set_gicr_typers(&mut self, _gicr_typers: Vec) {} fn as_any_concrete_mut(&mut self) -> &mut dyn Any { self @@ -94,7 +88,6 @@ pub mod kvm { ) -> Box { Box::new(KvmGicV3Its { device, - gicr_typers: vec![0; vcpu_count.try_into().unwrap()], gic_properties: [ KvmGicV3::get_dist_addr(), KvmGicV3::get_dist_size(), diff --git a/arch/src/aarch64/gic/mod.rs b/arch/src/aarch64/gic/mod.rs index e3f4e321f..3e91b4a6f 100644 --- a/arch/src/aarch64/gic/mod.rs +++ b/arch/src/aarch64/gic/mod.rs @@ -111,10 +111,10 @@ pub mod kvm { flags: u32, ) -> Result<()> { let attr = kvm_bindings::kvm_device_attr { + flags, group, attr, addr, - flags, }; device .set_device_attr(&attr) @@ -132,10 +132,10 @@ pub mod kvm { flags: u32, ) -> Result<()> { let mut attr = kvm_bindings::kvm_device_attr { + flags, group, attr, addr, - flags, }; device .get_device_attr(&mut attr) diff --git a/tests/integration.rs b/tests/integration.rs index ae91e1f1d..8bb2d9851 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -1814,8 +1814,8 @@ mod tests { tx_bytes, tx_frames, read_bytes, - read_ops, write_bytes, + read_ops, write_ops, } } diff --git a/vhost_user_backend/src/lib.rs b/vhost_user_backend/src/lib.rs index b7e8e1478..44388999e 100644 --- a/vhost_user_backend/src/lib.rs +++ b/vhost_user_backend/src/lib.rs @@ -437,9 +437,7 @@ struct VhostUserHandler { backend: Arc>, workers: Vec>, owned: bool, - features_acked: bool, acked_features: u64, - acked_protocol_features: u64, num_queues: usize, max_queue_size: usize, queues_per_thread: Vec, @@ -515,9 +513,7 @@ impl VhostUserHandler { backend, workers, owned: false, - features_acked: false, acked_features: 0, - acked_protocol_features: 0, num_queues, max_queue_size, queues_per_thread, @@ -554,9 +550,7 @@ impl VhostUserSlaveReqHandlerMut for VhostUserHandler { fn reset_owner(&mut self) -> VhostUserResult<()> { self.owned = false; - self.features_acked = false; self.acked_features = 0; - self.acked_protocol_features = 0; Ok(()) } @@ -570,7 +564,6 @@ impl VhostUserSlaveReqHandlerMut for VhostUserHandler { } self.acked_features = features; - self.features_acked = true; // If VHOST_USER_F_PROTOCOL_FEATURES has not been negotiated, // the ring is initialized in an enabled state. @@ -597,11 +590,10 @@ impl VhostUserSlaveReqHandlerMut for VhostUserHandler { Ok(self.backend.read().unwrap().protocol_features()) } - fn set_protocol_features(&mut self, features: u64) -> VhostUserResult<()> { + fn set_protocol_features(&mut self, _features: u64) -> VhostUserResult<()> { // Note: slave that reported VHOST_USER_F_PROTOCOL_FEATURES must // support this message even before VHOST_USER_SET_FEATURES was // called. - self.acked_protocol_features = features; Ok(()) } diff --git a/vhost_user_block/src/lib.rs b/vhost_user_block/src/lib.rs index 7cbd06c32..1c829ac25 100644 --- a/vhost_user_block/src/lib.rs +++ b/vhost_user_block/src/lib.rs @@ -469,10 +469,10 @@ impl VhostUserBlkBackendConfig { path, socket, num_queues, + queue_size, readonly, direct, poll_queue, - queue_size, }) } } diff --git a/vhost_user_net/src/lib.rs b/vhost_user_net/src/lib.rs index c58604ba0..f51e7c9a2 100644 --- a/vhost_user_net/src/lib.rs +++ b/vhost_user_net/src/lib.rs @@ -94,7 +94,6 @@ impl std::convert::From for std::io::Error { struct VhostUserNetThread { net: NetQueuePair, - vring_worker: Option>, kill_evt: EventFd, } @@ -102,7 +101,6 @@ impl VhostUserNetThread { /// Create a new virtio network device with the given TAP interface. fn new(tap: Tap) -> Result { Ok(VhostUserNetThread { - vring_worker: None, kill_evt: EventFd::new(EFD_NONBLOCK).map_err(Error::CreateKillEventFd)?, net: NetQueuePair { mem: None, @@ -119,7 +117,6 @@ impl VhostUserNetThread { pub fn set_vring_worker(&mut self, vring_worker: Option>) { self.net.epoll_fd = Some(vring_worker.as_ref().unwrap().as_raw_fd()); - self.vring_worker = vring_worker; } } @@ -345,11 +342,7 @@ pub fn start_net_backend(backend_command: &str) { } }; - let tap = if let Some(tap) = backend_config.tap.as_ref() { - Some(tap.as_str()) - } else { - None - }; + let tap = backend_config.tap.as_deref(); let net_backend = Arc::new(RwLock::new( VhostUserNetBackend::new( diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index 5e646a956..b0919a029 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -862,6 +862,7 @@ pub struct DeviceManager { // MSI Interrupt Manager msi_interrupt_manager: Arc>, + #[cfg_attr(feature = "mshv", allow(dead_code))] // Legacy Interrupt Manager legacy_interrupt_manager: Option>>,