mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: reevaluate #[allow] attributes
Remove stale #[allow]s whose lints no longer fire, convert the unconditionally-firing ones to #[expect], and keep the arch/feature-conditional ones as #[allow]. Verified across kvm/mshv, x86_64/aarch64, and --all-features. Part of #8326. Signed-off-by: Tushar Khatri <hello@tusharkhatri.in>
This commit is contained in:
committed by
Rob Bradford
parent
4f68b687aa
commit
b059475dfb
@@ -98,7 +98,7 @@ const HTTP_ROOT: &str = "/api/v1";
|
||||
/// The error message contained in the response is supposed to be user-facing,
|
||||
/// thus insightful and helpful while balancing technical accuracy and
|
||||
/// simplicity.
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn error_response(error: HttpError) -> Response {
|
||||
let mut response = Response::new(Version::Http11, error.status_code());
|
||||
|
||||
|
||||
@@ -603,7 +603,7 @@ pub trait RequestHandler {
|
||||
pub type ApiRequest =
|
||||
Box<dyn FnOnce(&mut dyn RequestHandler) -> Result<bool, VmmError> + Send + 'static>;
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
fn get_response<Action: ApiAction>(
|
||||
action: &Action,
|
||||
api_evt: EventFd,
|
||||
|
||||
@@ -7,7 +7,6 @@ pub const CLONE_CLEAR_SIGHAND: u64 = 0x100000000;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Default)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub struct clone_args {
|
||||
pub flags: u64,
|
||||
pub pidfd: u64,
|
||||
|
||||
@@ -1046,7 +1046,7 @@ impl PlatformConfig {
|
||||
}
|
||||
|
||||
impl MemoryConfig {
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn parse(memory: &str, memory_zones: Option<Vec<&str>>) -> Result<Self> {
|
||||
let mut parser = OptionParser::new();
|
||||
parser
|
||||
@@ -4517,7 +4517,6 @@ mod unit_tests {
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn make_vhost_user_config(
|
||||
socket: &str,
|
||||
virtio_id: u64,
|
||||
|
||||
@@ -842,8 +842,8 @@ impl VcpuState {
|
||||
}
|
||||
|
||||
impl CpuManager {
|
||||
#[allow(unused_variables)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(unused_variables)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
config: &CpusConfig,
|
||||
vm: Arc<dyn hypervisor::Vm>,
|
||||
|
||||
@@ -1197,7 +1197,7 @@ fn use_64bit_bar_for_virtio_device(
|
||||
}
|
||||
|
||||
impl DeviceManager {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
io_bus: Arc<Bus>,
|
||||
mmio_bus: Arc<Bus>,
|
||||
@@ -1465,7 +1465,7 @@ impl DeviceManager {
|
||||
self.add_interrupt_controller(snapshot)
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn create_devices(
|
||||
&mut self,
|
||||
console_info: Option<ConsoleInfo>,
|
||||
@@ -4305,7 +4305,7 @@ impl DeviceManager {
|
||||
Ok(vec![])
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
fn add_virtio_pci_device(
|
||||
&mut self,
|
||||
virtio_device: Arc<Mutex<dyn virtio_devices::VirtioDevice>>,
|
||||
@@ -4842,7 +4842,6 @@ impl DeviceManager {
|
||||
.pci_device_handle
|
||||
.as_ref()
|
||||
.ok_or(DeviceManagerError::MissingPciDevice)?;
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
if let PciDeviceHandle::Virtio(virtio_pci_device) = pci_device_handle {
|
||||
let device_type = VirtioDeviceType::from(
|
||||
virtio_pci_device
|
||||
|
||||
@@ -273,7 +273,7 @@ pub fn extract_sev_features(igvm_file: &IgvmFile) -> u64 {
|
||||
/// NOTE: KVM and MSHV have different page type values and CPUID/VMSA handling.
|
||||
/// Hypervisor-specific code paths are gated by runtime type checks. A future
|
||||
/// refactor could split these into separate KVM/MSHV loader implementations.
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn load_igvm(
|
||||
igvm_file: IgvmFile,
|
||||
memory_manager: Arc<Mutex<MemoryManager>>,
|
||||
|
||||
@@ -447,8 +447,7 @@ pub fn start_event_monitor_thread(
|
||||
.map_err(Error::EventMonitorThreadSpawn)
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub fn start_vmm_thread(
|
||||
vmm_version: VmmVersionInfo,
|
||||
http_path: &Option<String>,
|
||||
@@ -717,7 +716,7 @@ impl Vmm {
|
||||
|
||||
for signal in signals.forever() {
|
||||
match signal {
|
||||
#[allow(clippy::collapsible_match)]
|
||||
#[expect(clippy::collapsible_match)]
|
||||
SIGTERM | SIGINT => {
|
||||
if exit_evt.write(1).is_err() {
|
||||
// Resetting the terminal is usually done as the VMM exits
|
||||
|
||||
@@ -1140,7 +1140,7 @@ impl MemoryManager {
|
||||
/// snapshot file followed by a `UFFDIO_COPY` to resolve the fault and
|
||||
/// wake the faulting thread. When no fault is pending, one prefault
|
||||
/// page is copied per loop iteration.
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
fn uffd_handler_loop(
|
||||
uffd_fd: OwnedFd,
|
||||
stop_event: EventFd,
|
||||
@@ -1643,7 +1643,6 @@ impl MemoryManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
vm: Arc<dyn hypervisor::Vm>,
|
||||
config: &MemoryConfig,
|
||||
@@ -1899,7 +1898,7 @@ impl MemoryManager {
|
||||
Ok(Arc::new(Mutex::new(memory_manager)))
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub fn new_from_snapshot(
|
||||
snapshot: &Snapshot,
|
||||
vm: Arc<dyn hypervisor::Vm>,
|
||||
@@ -2042,7 +2041,7 @@ impl MemoryManager {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub fn create_ram_region_raw(
|
||||
backing_file: &Option<PathBuf>,
|
||||
file_offset: u64,
|
||||
@@ -2179,7 +2178,7 @@ impl MemoryManager {
|
||||
Ok(region)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub fn create_ram_region(
|
||||
backing_file: &Option<PathBuf>,
|
||||
file_offset: u64,
|
||||
|
||||
@@ -560,8 +560,8 @@ impl Vm {
|
||||
.with_migrate_ma(0)
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub fn new_from_memory_manager(
|
||||
config: Arc<Mutex<VmConfig>>,
|
||||
memory_manager: Arc<Mutex<MemoryManager>>,
|
||||
@@ -751,7 +751,7 @@ impl Vm {
|
||||
}
|
||||
|
||||
/// Create and configure the CPU manager.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
fn create_cpu_manager(
|
||||
config: &Arc<Mutex<VmConfig>>,
|
||||
vm: Arc<dyn hypervisor::Vm>,
|
||||
@@ -828,7 +828,7 @@ impl Vm {
|
||||
}
|
||||
|
||||
/// Create and configure the device manager.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
fn create_device_manager(
|
||||
io_bus: Arc<Bus>,
|
||||
mmio_bus: Arc<Bus>,
|
||||
@@ -881,7 +881,7 @@ impl Vm {
|
||||
/// - KVM (x86_64, aarch64, riscv64)
|
||||
/// - MSHV (x86_64, aarch64)
|
||||
/// - SEV-SNP (MSHV with confidential computing)
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
fn hypervisor_specific_init(
|
||||
vm: &Arc<dyn hypervisor::Vm>,
|
||||
memory_manager: &Arc<Mutex<MemoryManager>>,
|
||||
@@ -995,7 +995,7 @@ impl Vm {
|
||||
|
||||
/// Initialize SEV-SNP specific components.
|
||||
#[cfg(feature = "sev_snp")]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
fn init_sev_snp(
|
||||
vm: &Arc<dyn hypervisor::Vm>,
|
||||
memory_manager: &Arc<Mutex<MemoryManager>>,
|
||||
@@ -1325,7 +1325,7 @@ impl Vm {
|
||||
Ok(numa_nodes)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
vm_config: Arc<Mutex<VmConfig>>,
|
||||
exit_evt: EventFd,
|
||||
@@ -1496,7 +1496,7 @@ impl Vm {
|
||||
Ok(cmdline)
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
|
||||
fn load_firmware(
|
||||
mut firmware: &File,
|
||||
@@ -1561,7 +1561,7 @@ impl Vm {
|
||||
}
|
||||
|
||||
#[cfg(feature = "igvm")]
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
fn load_igvm(
|
||||
igvm_file: IgvmFile,
|
||||
memory_manager: Arc<Mutex<MemoryManager>>,
|
||||
@@ -1619,7 +1619,7 @@ impl Vm {
|
||||
///
|
||||
/// For x86_64, the boot path is the same.
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
fn load_kernel(
|
||||
mut kernel: File,
|
||||
cmdline: Option<Cmdline>,
|
||||
|
||||
Reference in New Issue
Block a user