vmm: Fix AArch64 clippy warnings of vmm and other crates

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
Michael Zhao 2020-08-23 15:45:44 +08:00 committed by Sebastien Boeuf
parent 46b8f38987
commit afc98a5ec9
7 changed files with 9 additions and 11 deletions

View File

@ -47,8 +47,7 @@ impl Gic {
impl InterruptController for Gic {
fn enable(&self) -> Result<()> {
&self
.interrupt_source_group
self.interrupt_source_group
.enable()
.map_err(Error::EnableInterrupt)?;
Ok(())

View File

@ -949,6 +949,7 @@ impl cpu::Vcpu for KvmVcpu {
#[allow(unused_variables)]
#[cfg(target_arch = "aarch64")]
fn set_state(&self, state: &CpuState) -> cpu::Result<()> {
warn!("CPU state was not restored");
Ok(())
}
}

View File

@ -2,8 +2,6 @@
//
// SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
#[cfg(target_arch = "aarch64")]
use arch;
#[cfg(target_arch = "x86_64")]
use std::collections::btree_map::BTreeMap;
use std::result;
@ -65,6 +63,7 @@ impl GsiAllocator {
}
#[cfg(target_arch = "aarch64")]
#[allow(clippy::new_without_default)]
/// New GSI allocator
pub fn new() -> Self {
GsiAllocator {

View File

@ -981,12 +981,10 @@ impl CpuManager {
#[cfg(target_arch = "aarch64")]
pub fn get_mpidrs(&self) -> Vec<u64> {
let vcpu_mpidrs = self
.vcpus
self.vcpus
.iter()
.map(|cpu| cpu.lock().unwrap().get_mpidr())
.collect();
vcpu_mpidrs
.collect()
}
#[cfg(feature = "acpi")]

View File

@ -1356,7 +1356,7 @@ impl DeviceManager {
self.address_manager
.mmio_bus
.insert(rtc_device.clone(), addr.0, MMIO_LEN)
.insert(rtc_device, addr.0, MMIO_LEN)
.map_err(DeviceManagerError::BusError)?;
self.id_to_dev_info.insert(

View File

@ -604,6 +604,7 @@ impl MemoryManager {
// If the next area is hotplugged RAM, the start address needs to be aligned
// to 128MiB boundary, and a gap of 256MiB need to be set before it.
// On x86_64, it must also start at the 64bit start.
#[allow(clippy::let_and_return)]
fn start_addr(mem_end: GuestAddress, with_gap: bool) -> GuestAddress {
let start_addr = if with_gap {
GuestAddress((mem_end.0 + 1 + (256 << 20)) & !((128 << 20) - 1))

View File

@ -401,7 +401,7 @@ impl Vm {
#[cfg(target_arch = "x86_64")]
vm.enable_split_irq().unwrap();
let vm_snapshot = get_vm_snapshot(snapshot).map_err(Error::Restore)?;
let config = vm_snapshot.config.clone();
let config = vm_snapshot.config;
if let Some(state) = vm_snapshot.state {
vm.set_state(&state)
.map_err(|e| Error::Restore(MigratableError::Restore(e.into())))?;
@ -1576,7 +1576,7 @@ mod tests {
&CString::new("console=tty0").unwrap(),
vec![0],
&dev_info,
&gic,
&*gic,
&None,
&None,
)