Repository: firecracker-microvm/firecracker
File: src/vmm/src/builder.rs (Rust)

Code before:
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

//! Enables pre-boot setup, instantiation and booting of a Firecracker VMM.
use std::fmt::Debug;
use std::io;
#[cfg(feature = "gdb")]
use std::sync::mpsc;
use std::sync::{Arc, Mutex};

use event_manager::{MutEventSubscriber, SubscriberOps};
use libc::EFD_NONBLOCK;
use linux_loader::cmdline::Cmdline as LoaderKernelCmdline;
#[cfg(target_arch = "aarch64")]
use log::warn;
use userfaultfd::Uffd;
use utils::time::TimestampUs;
#[cfg(target_arch = "aarch64")]
use vm_superio::Rtc;
use vm_superio::Serial;
use vmm_sys_util::eventfd::EventFd;

#[cfg(target_arch = "aarch64")]
use crate::arch::aarch64::pvtime::{PVTime, PVTimeConstructorArgs, PVTimeError};
use crate::arch::{ConfigurationError, configure_system_for_boot, load_kernel};
#[cfg(target_arch = "aarch64")]
use crate::construct_kvm_mpidrs;
use crate::cpu_config::templates::{
    GetCpuTemplate, GetCpuTemplateError, GuestConfigError, KvmCapability,
};
use crate::device_manager::acpi::ACPIDeviceManager;
#[cfg(target_arch = "x86_64")]
use crate::device_manager::legacy::PortIODeviceManager;
use crate::device_manager::mmio::{MMIODeviceManager, MmioError};
use crate::device_manager::persist::{
    ACPIDeviceManagerConstructorArgs, ACPIDeviceManagerRestoreError, MMIODevManagerConstructorArgs,
};
use crate::device_manager::resources::ResourceAllocator;
use crate::devices::BusDevice;
use crate::devices::acpi::vmgenid::{VmGenId, VmGenIdError};

Review comment (suggestion):
let's avoid conditionally importing non-arch-specific dependencies. We can probably just avoid the `use` and call `log::warn` directly.

Code after:
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

//! Enables pre-boot setup, instantiation and booting of a Firecracker VMM.

use std::fmt::Debug;
use std::io;
#[cfg(feature = "gdb")]
use std::sync::mpsc;
use std::sync::{Arc, Mutex};

use event_manager::{MutEventSubscriber, SubscriberOps};
use libc::EFD_NONBLOCK;
use linux_loader::cmdline::Cmdline as LoaderKernelCmdline;
use userfaultfd::Uffd;
use utils::time::TimestampUs;
#[cfg(target_arch = "aarch64")]
use vm_memory::GuestAddress;
#[cfg(target_arch = "aarch64")]
use vm_superio::Rtc;
use vm_superio::Serial;
use vmm_sys_util::eventfd::EventFd;

use crate::arch::{ConfigurationError, configure_system_for_boot, load_kernel};
#[cfg(target_arch = "aarch64")]
use crate::construct_kvm_mpidrs;
use crate::cpu_config::templates::{
    GetCpuTemplate, GetCpuTemplateError, GuestConfigError, KvmCapability,
};
use crate::device_manager::acpi::ACPIDeviceManager;
#[cfg(target_arch = "x86_64")]
use crate::device_manager::legacy::PortIODeviceManager;
use crate::device_manager::mmio::{MMIODeviceManager, MmioError};
use crate::device_manager::persist::{
    ACPIDeviceManagerConstructorArgs, ACPIDeviceManagerRestoreError, MMIODevManagerConstructorArgs,
};
use crate::device_manager::resources::ResourceAllocator;
use crate::devices::BusDevice;
use crate::devices::acpi::vmgenid::{VmGenId, VmGenIdError};
#[cfg(target_arch = "aarch64")]