aarch64: Address Rust 1.51.0 clippy issue (vec_init_then_push)

--> arch/src/aarch64/mod.rs:82:5
    |
82  | /     let mut regions = Vec::new();
83  | |     // 0 ~ 256 MiB: Reserved
84  | |     regions.push((
85  | |         GuestAddress(0),
...   |
107 | |         RegionType::Ram,
108 | |     ));
    | |_______^ help: consider using the `vec![]` macro: `let mut regions = vec![..];`
    |
    = note: `-D clippy::vec-init-then-push` implied by `-D warnings`
    = 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:
Rob Bradford 2021-03-25 17:01:21 +00:00
parent 4da6bcd5d5
commit 970bc05271

View File

@ -79,35 +79,31 @@ pub fn configure_vcpu(
} }
pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, RegionType)> { pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, RegionType)> {
let mut regions = Vec::new(); vec![
// 0 ~ 256 MiB: Reserved // 0 ~ 256 MiB: Reserved
regions.push(( (
GuestAddress(0), GuestAddress(0),
layout::MEM_32BIT_DEVICES_START.0 as usize, layout::MEM_32BIT_DEVICES_START.0 as usize,
RegionType::Reserved, RegionType::Reserved,
)); ),
// 256 MiB ~ 1 G: MMIO space
// 256 MiB ~ 1 G: MMIO space (
regions.push(( layout::MEM_32BIT_DEVICES_START,
layout::MEM_32BIT_DEVICES_START, layout::MEM_32BIT_DEVICES_SIZE as usize,
layout::MEM_32BIT_DEVICES_SIZE as usize, RegionType::SubRegion,
RegionType::SubRegion, ),
)); // 1G ~ 2G: reserved. The leading 256M for PCIe MMCONFIG space
(
// 1G ~ 2G: reserved. The leading 256M for PCIe MMCONFIG space layout::PCI_MMCONFIG_START,
regions.push(( (layout::RAM_64BIT_START - layout::PCI_MMCONFIG_START.0) as usize,
layout::PCI_MMCONFIG_START, RegionType::Reserved,
(layout::RAM_64BIT_START - layout::PCI_MMCONFIG_START.0) as usize, ),
RegionType::Reserved, (
)); GuestAddress(layout::RAM_64BIT_START),
size as usize,
regions.push(( RegionType::Ram,
GuestAddress(layout::RAM_64BIT_START), ),
size as usize, ]
RegionType::Ram,
));
regions
} }
/// Configures the system and should be called once per vm before starting vcpu threads. /// Configures the system and should be called once per vm before starting vcpu threads.