mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
vmm: Address Rust 1.51.0 clippy issue (vec_init_then_push)
warning: calls to `push` immediately after creation --> vmm/src/cpu.rs:630:9 | 630 | / let mut cpuid_patches = Vec::new(); 631 | | 632 | | // Patch tsc deadline timer bit 633 | | cpuid_patches.push(CpuidPatch { ... | 662 | | edx_bit: Some(MTRR_EDX_BIT), 663 | | }); | |___________^ help: consider using the `vec![]` macro: `let mut cpuid_patches = vec![..];` | = note: `#[warn(clippy::vec_init_then_push)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
9762c8bc28
commit
3b8d1f1411
@ -627,40 +627,38 @@ impl CpuManager {
|
|||||||
phys_bits: u8,
|
phys_bits: u8,
|
||||||
kvm_hyperv: bool,
|
kvm_hyperv: bool,
|
||||||
) -> Result<CpuId> {
|
) -> Result<CpuId> {
|
||||||
let mut cpuid_patches = Vec::new();
|
let cpuid_patches = vec![
|
||||||
|
// Patch tsc deadline timer bit
|
||||||
// Patch tsc deadline timer bit
|
CpuidPatch {
|
||||||
cpuid_patches.push(CpuidPatch {
|
function: 1,
|
||||||
function: 1,
|
index: 0,
|
||||||
index: 0,
|
flags_bit: None,
|
||||||
flags_bit: None,
|
eax_bit: None,
|
||||||
eax_bit: None,
|
ebx_bit: None,
|
||||||
ebx_bit: None,
|
ecx_bit: Some(TSC_DEADLINE_TIMER_ECX_BIT),
|
||||||
ecx_bit: Some(TSC_DEADLINE_TIMER_ECX_BIT),
|
edx_bit: None,
|
||||||
edx_bit: None,
|
},
|
||||||
});
|
// Patch hypervisor bit
|
||||||
|
CpuidPatch {
|
||||||
// Patch hypervisor bit
|
function: 1,
|
||||||
cpuid_patches.push(CpuidPatch {
|
index: 0,
|
||||||
function: 1,
|
flags_bit: None,
|
||||||
index: 0,
|
eax_bit: None,
|
||||||
flags_bit: None,
|
ebx_bit: None,
|
||||||
eax_bit: None,
|
ecx_bit: Some(HYPERVISOR_ECX_BIT),
|
||||||
ebx_bit: None,
|
edx_bit: None,
|
||||||
ecx_bit: Some(HYPERVISOR_ECX_BIT),
|
},
|
||||||
edx_bit: None,
|
// Enable MTRR feature
|
||||||
});
|
CpuidPatch {
|
||||||
|
function: 1,
|
||||||
// Enable MTRR feature
|
index: 0,
|
||||||
cpuid_patches.push(CpuidPatch {
|
flags_bit: None,
|
||||||
function: 1,
|
eax_bit: None,
|
||||||
index: 0,
|
ebx_bit: None,
|
||||||
flags_bit: None,
|
ecx_bit: None,
|
||||||
eax_bit: None,
|
edx_bit: Some(MTRR_EDX_BIT),
|
||||||
ebx_bit: None,
|
},
|
||||||
ecx_bit: None,
|
];
|
||||||
edx_bit: Some(MTRR_EDX_BIT),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Supported CPUID
|
// Supported CPUID
|
||||||
let mut cpuid = hypervisor
|
let mut cpuid = hypervisor
|
||||||
|
@ -2304,11 +2304,10 @@ impl DeviceManager {
|
|||||||
)
|
)
|
||||||
.map_err(DeviceManagerError::MemoryManager)?;
|
.map_err(DeviceManagerError::MemoryManager)?;
|
||||||
|
|
||||||
let mut region_list = Vec::new();
|
let region_list = vec![VirtioSharedMemory {
|
||||||
region_list.push(VirtioSharedMemory {
|
|
||||||
offset: 0,
|
offset: 0,
|
||||||
len: cache_size,
|
len: cache_size,
|
||||||
});
|
}];
|
||||||
|
|
||||||
Some((
|
Some((
|
||||||
VirtioSharedMemoryList {
|
VirtioSharedMemoryList {
|
||||||
@ -4000,7 +3999,7 @@ impl BusDevice for DeviceManager {
|
|||||||
B0EJ_FIELD_OFFSET => {
|
B0EJ_FIELD_OFFSET => {
|
||||||
assert!(data.len() == B0EJ_FIELD_SIZE);
|
assert!(data.len() == B0EJ_FIELD_SIZE);
|
||||||
let mut data_array: [u8; 4] = [0, 0, 0, 0];
|
let mut data_array: [u8; 4] = [0, 0, 0, 0];
|
||||||
data_array.copy_from_slice(&data[..]);
|
data_array.copy_from_slice(&data);
|
||||||
let device_bitmap = u32::from_le_bytes(data_array);
|
let device_bitmap = u32::from_le_bytes(data_array);
|
||||||
|
|
||||||
for device_id in 0..32 {
|
for device_id in 0..32 {
|
||||||
|
Loading…
Reference in New Issue
Block a user