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 <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2021-03-29 10:23:58 +02:00 committed by Rob Bradford
parent 943377e6a3
commit 73e8fd4d72
7 changed files with 8 additions and 29 deletions

View File

@ -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<T> = result::Result<T, Error>;
@ -16,9 +15,6 @@ pub mod kvm {
/// The hypervisor agnostic device
device: Arc<dyn hypervisor::Device>,
/// Vector holding values of GICR_TYPER for each vCPU
gicr_typers: Vec<u64>,
/// 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<u64>) {
self.gicr_typers = gicr_typers;
}
fn set_gicr_typers(&mut self, _gicr_typers: Vec<u64>) {}
fn as_any_concrete_mut(&mut self) -> &mut dyn Any {
self
@ -94,7 +88,6 @@ pub mod kvm {
) -> Box<dyn GicDevice> {
Box::new(KvmGicV3Its {
device,
gicr_typers: vec![0; vcpu_count.try_into().unwrap()],
gic_properties: [
KvmGicV3::get_dist_addr(),
KvmGicV3::get_dist_size(),

View File

@ -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)

View File

@ -1814,8 +1814,8 @@ mod tests {
tx_bytes,
tx_frames,
read_bytes,
read_ops,
write_bytes,
read_ops,
write_ops,
}
}

View File

@ -437,9 +437,7 @@ struct VhostUserHandler<S: VhostUserBackend> {
backend: Arc<RwLock<S>>,
workers: Vec<Arc<VringWorker>>,
owned: bool,
features_acked: bool,
acked_features: u64,
acked_protocol_features: u64,
num_queues: usize,
max_queue_size: usize,
queues_per_thread: Vec<u64>,
@ -515,9 +513,7 @@ impl<S: VhostUserBackend> VhostUserHandler<S> {
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<S: VhostUserBackend> VhostUserSlaveReqHandlerMut for VhostUserHandler<S> {
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<S: VhostUserBackend> VhostUserSlaveReqHandlerMut for VhostUserHandler<S> {
}
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<S: VhostUserBackend> VhostUserSlaveReqHandlerMut for VhostUserHandler<S> {
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(())
}

View File

@ -469,10 +469,10 @@ impl VhostUserBlkBackendConfig {
path,
socket,
num_queues,
queue_size,
readonly,
direct,
poll_queue,
queue_size,
})
}
}

View File

@ -94,7 +94,6 @@ impl std::convert::From<Error> for std::io::Error {
struct VhostUserNetThread {
net: NetQueuePair,
vring_worker: Option<Arc<VringWorker>>,
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<Self> {
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<Arc<VringWorker>>) {
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(

View File

@ -862,6 +862,7 @@ pub struct DeviceManager {
// MSI Interrupt Manager
msi_interrupt_manager: Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
#[cfg_attr(feature = "mshv", allow(dead_code))]
// Legacy Interrupt Manager
legacy_interrupt_manager: Option<Arc<dyn InterruptManager<GroupConfig = LegacyIrqGroupConfig>>>,