From 970bc05271760765f37649eb45edeb74e5f49919 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 25 Mar 2021 17:01:21 +0000 Subject: [PATCH] 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 --- arch/src/aarch64/mod.rs | 54 +++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/arch/src/aarch64/mod.rs b/arch/src/aarch64/mod.rs index 2c0d110af..4c7049748 100644 --- a/arch/src/aarch64/mod.rs +++ b/arch/src/aarch64/mod.rs @@ -79,35 +79,31 @@ pub fn configure_vcpu( } pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, RegionType)> { - let mut regions = Vec::new(); - // 0 ~ 256 MiB: Reserved - regions.push(( - GuestAddress(0), - layout::MEM_32BIT_DEVICES_START.0 as usize, - RegionType::Reserved, - )); - - // 256 MiB ~ 1 G: MMIO space - regions.push(( - layout::MEM_32BIT_DEVICES_START, - layout::MEM_32BIT_DEVICES_SIZE as usize, - RegionType::SubRegion, - )); - - // 1G ~ 2G: reserved. The leading 256M for PCIe MMCONFIG space - regions.push(( - layout::PCI_MMCONFIG_START, - (layout::RAM_64BIT_START - layout::PCI_MMCONFIG_START.0) as usize, - RegionType::Reserved, - )); - - regions.push(( - GuestAddress(layout::RAM_64BIT_START), - size as usize, - RegionType::Ram, - )); - - regions + vec![ + // 0 ~ 256 MiB: Reserved + ( + GuestAddress(0), + layout::MEM_32BIT_DEVICES_START.0 as usize, + RegionType::Reserved, + ), + // 256 MiB ~ 1 G: MMIO space + ( + layout::MEM_32BIT_DEVICES_START, + layout::MEM_32BIT_DEVICES_SIZE as usize, + RegionType::SubRegion, + ), + // 1G ~ 2G: reserved. The leading 256M for PCIe MMCONFIG space + ( + layout::PCI_MMCONFIG_START, + (layout::RAM_64BIT_START - layout::PCI_MMCONFIG_START.0) as usize, + RegionType::Reserved, + ), + ( + GuestAddress(layout::RAM_64BIT_START), + size as usize, + RegionType::Ram, + ), + ] } /// Configures the system and should be called once per vm before starting vcpu threads.