mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
clippy: Address the issue 'needless-borrow'
Issue from beta verion of clippy:
Error: --> vm-virtio/src/queue.rs:700:59
|
700 | if let Some(used_event) = self.get_used_event(&mem) {
| ^^^^ help: change this to: `mem`
|
= note: `-D clippy::needless-borrow` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
@@ -678,7 +678,7 @@ mod mock_vmm {
|
||||
};
|
||||
|
||||
if let Some(mem) = memory {
|
||||
vmm.write_memory(mem.0, &mem.1).unwrap();
|
||||
vmm.write_memory(mem.0, mem.1).unwrap();
|
||||
}
|
||||
|
||||
vmm
|
||||
@@ -693,7 +693,7 @@ mod mock_vmm {
|
||||
let ip = self.cpu_state(cpu_id).unwrap().ip();
|
||||
let mut emulator = Emulator::new(self);
|
||||
|
||||
let new_state = emulator.emulate_insn_stream(cpu_id, &insn, num_insn)?;
|
||||
let new_state = emulator.emulate_insn_stream(cpu_id, insn, num_insn)?;
|
||||
if num_insn.is_none() {
|
||||
assert_eq!(ip + insn.len() as u64, new_state.ip());
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ impl vm::Vm for KvmVm {
|
||||
unsafe {
|
||||
let entries_slice: &mut [kvm_irq_routing_entry] =
|
||||
irq_routing[0].entries.as_mut_slice(entries.len());
|
||||
entries_slice.copy_from_slice(&entries);
|
||||
entries_slice.copy_from_slice(entries);
|
||||
}
|
||||
|
||||
self.fd
|
||||
@@ -801,7 +801,7 @@ impl cpu::Vcpu for KvmVcpu {
|
||||
///
|
||||
fn set_xcrs(&self, xcrs: &ExtendedControlRegisters) -> cpu::Result<()> {
|
||||
self.fd
|
||||
.set_xcrs(&xcrs)
|
||||
.set_xcrs(xcrs)
|
||||
.map_err(|e| cpu::HypervisorCpuError::SetXcsr(e.into()))
|
||||
}
|
||||
///
|
||||
|
||||
@@ -235,7 +235,7 @@ impl cpu::Vcpu for MshvVcpu {
|
||||
///
|
||||
fn set_xcrs(&self, xcrs: &ExtendedControlRegisters) -> cpu::Result<()> {
|
||||
self.fd
|
||||
.set_xcrs(&xcrs)
|
||||
.set_xcrs(xcrs)
|
||||
.map_err(|e| cpu::HypervisorCpuError::SetXcsr(e.into()))
|
||||
}
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
@@ -708,7 +708,7 @@ impl vm::Vm for MshvVm {
|
||||
debug!("register_irqfd fd {} gsi {}", fd.as_raw_fd(), gsi);
|
||||
|
||||
self.fd
|
||||
.register_irqfd(&fd, gsi)
|
||||
.register_irqfd(fd, gsi)
|
||||
.map_err(|e| vm::HypervisorVmError::RegisterIrqFd(e.into()))?;
|
||||
|
||||
Ok(())
|
||||
@@ -720,7 +720,7 @@ impl vm::Vm for MshvVm {
|
||||
debug!("unregister_irqfd fd {} gsi {}", fd.as_raw_fd(), gsi);
|
||||
|
||||
self.fd
|
||||
.unregister_irqfd(&fd, gsi)
|
||||
.unregister_irqfd(fd, gsi)
|
||||
.map_err(|e| vm::HypervisorVmError::UnregisterIrqFd(e.into()))?;
|
||||
|
||||
Ok(())
|
||||
@@ -833,7 +833,7 @@ impl vm::Vm for MshvVm {
|
||||
unsafe {
|
||||
let entries_slice: &mut [mshv_msi_routing_entry] =
|
||||
msi_routing[0].entries.as_mut_slice(entries.len());
|
||||
entries_slice.copy_from_slice(&entries);
|
||||
entries_slice.copy_from_slice(entries);
|
||||
}
|
||||
|
||||
self.fd
|
||||
|
||||
Reference in New Issue
Block a user