From 17cd14d7bfb50c86c73f05a237b49699db305ac2 Mon Sep 17 00:00:00 2001 From: Jgprog117 Date: Sat, 31 Jan 2026 12:28:38 +0100 Subject: [PATCH] Consolidate duplicate HypervisorType enum Removed duplicate HypervisorType enum definition from sandbox/hypervisor.rs and added import to use the existing definition from virtual_machine module. Both enums were identical, so consolidating reduces code duplication and ensures a single source of truth for the hypervisor type enumeration. Fixes #1202 Signed-off-by: Jgprog117 --- src/hyperlight_host/src/sandbox/hypervisor.rs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/hyperlight_host/src/sandbox/hypervisor.rs b/src/hyperlight_host/src/sandbox/hypervisor.rs index bf205adaa..c0aadfe61 100644 --- a/src/hyperlight_host/src/sandbox/hypervisor.rs +++ b/src/hyperlight_host/src/sandbox/hypervisor.rs @@ -21,6 +21,7 @@ use std::sync::OnceLock; use crate::hypervisor::virtual_machine::kvm; #[cfg(mshv3)] use crate::hypervisor::virtual_machine::mshv; +use crate::hypervisor::virtual_machine::HypervisorType; static AVAILABLE_HYPERVISOR: OnceLock> = OnceLock::new(); @@ -65,19 +66,6 @@ pub fn get_available_hypervisor() -> &'static Option { }) } -/// The hypervisor types available for the current platform -#[derive(PartialEq, Eq, Debug)] -pub(crate) enum HypervisorType { - #[cfg(kvm)] - Kvm, - - #[cfg(mshv3)] - Mshv, - - #[cfg(target_os = "windows")] - Whp, -} - // Compiler error if no hypervisor type is available #[cfg(not(any(kvm, mshv3, target_os = "windows")))] compile_error!(