hypervisor: kvm: aarch64: Use struct initialisation
error: field assignment outside of initializer for an instance created with Default::default()
Error: --> hypervisor/src/kvm/mod.rs:1239:9
|
1239 | state.mp_state = self.get_mp_state()?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::field-reassign-with-default` implied by `-D warnings`
note: consider initializing the variable with `kvm::aarch64::VcpuKvmState { mp_state: self.get_mp_state()?, ..Default::default() }` and removing relevant reassignments
--> hypervisor/src/kvm/mod.rs:1237:9
|
1237 | let mut state = CpuState::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
3ad94ddf7c
commit
184baff355
1 changed files with 5 additions and 4 deletions
|
|
@ -1234,12 +1234,13 @@ impl cpu::Vcpu for KvmVcpu {
|
|||
///
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
fn state(&self) -> cpu::Result<CpuState> {
|
||||
let mut state = CpuState::default();
|
||||
// Get this vCPUs multiprocessing state.
|
||||
state.mp_state = self.get_mp_state()?;
|
||||
let mut state = CpuState {
|
||||
mp_state: self.get_mp_state()?,
|
||||
mpidr: self.read_mpidr()?,
|
||||
..Default::default()
|
||||
};
|
||||
self.core_registers(&mut state.core_regs)?;
|
||||
self.system_registers(&mut state.sys_regs)?;
|
||||
state.mpidr = self.read_mpidr()?;
|
||||
|
||||
Ok(state)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue