kata-types: Clean up noise caused by unformatted code

For a long time, there has been unformatted code in the kata-types
codebase, for example:
```
if qemu.memory_info.enable_guest_swap {
-                return Err(eother!(
-                    "Qemu hypervisor doesn't support enable_guest_swap"
-                ));
+                return Err(eother!("Qemu hypervisor doesn't support
enable_guest_swap"));
             }
...
-    }, device::DRIVER_NVDIMM_TYPE, eother, resolve_path
+    },
+    device::DRIVER_NVDIMM_TYPE,
+    eother, resolve_path,
-use std::collections::HashMap;
-use anyhow::{Result, anyhow};
+use anyhow::{anyhow, Result};
 use std::collections::hash_map::Entry;
+use std::collections::HashMap;
-/// DRIVER_VFIO_PCI_GK_TYPE is the device driver for vfio-pci 
+/// DRIVER_VFIO_PCI_GK_TYPE is the device driver for vfio-pci
```
This has brought unnecessary difficulties in version maintenance and
commit difficulties. This commit will address this issue.

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
alex.lyn
2025-04-18 17:31:43 +08:00
parent 97a1942f86
commit 9eb3fcb84b
4 changed files with 12 additions and 10 deletions

View File

@@ -119,7 +119,9 @@ impl ConfigPlugin for QemuConfig {
}
if qemu.boot_info.image.is_empty() && qemu.boot_info.initrd.is_empty() {
// IBM SE (CCW + confidential guest) does not require neither image nor initrd.
if !(qemu.boot_info.vm_rootfs_driver.ends_with("ccw") && qemu.security_info.confidential_guest) {
if !(qemu.boot_info.vm_rootfs_driver.ends_with("ccw")
&& qemu.security_info.confidential_guest)
{
return Err(eother!(
"Both guest boot image and initrd for qemu are empty"
));
@@ -151,9 +153,7 @@ impl ConfigPlugin for QemuConfig {
}
if qemu.memory_info.enable_guest_swap {
return Err(eother!(
"Qemu hypervisor doesn't support enable_guest_swap"
));
return Err(eother!("Qemu hypervisor doesn't support enable_guest_swap"));
}
}

View File

@@ -13,7 +13,9 @@ use crate::{
config::{
default::{self, MAX_REMOTE_VCPUS, MIN_REMOTE_MEMORY_SIZE_MB},
ConfigPlugin,
}, device::DRIVER_NVDIMM_TYPE, eother, resolve_path
},
device::DRIVER_NVDIMM_TYPE,
eother, resolve_path,
};
use super::register_hypervisor_plugin;

View File

@@ -15,7 +15,7 @@ pub const DRIVER_BLK_MMIO_TYPE: &str = "mmioblk";
pub const DRIVER_SCSI_TYPE: &str = "scsi";
/// DRIVER_NVDIMM_TYPE is the device driver for nvdimm
pub const DRIVER_NVDIMM_TYPE: &str = "nvdimm";
/// DRIVER_VFIO_PCI_GK_TYPE is the device driver for vfio-pci
/// DRIVER_VFIO_PCI_GK_TYPE is the device driver for vfio-pci
/// while the device will be bound to a guest kernel driver
pub const DRIVER_VFIO_PCI_GK_TYPE: &str = "vfio-pci-gk";
/// DRIVER_VFIO_PCI_TYPE is the device driver for vfio-pci

View File

@@ -3,16 +3,16 @@
// SPDX-License-Identifier: Apache-2.0
//
use std::collections::HashMap;
use anyhow::{Result, anyhow};
use anyhow::{anyhow, Result};
use std::collections::hash_map::Entry;
use std::collections::HashMap;
/// Generic manager to manage registered handlers.
pub struct HandlerManager<H> {
handlers: HashMap<String, H>,
}
impl<H> Default for HandlerManager<H>
impl<H> Default for HandlerManager<H>
where
H: Clone,
{
@@ -21,7 +21,7 @@ where
}
}
impl<H> HandlerManager<H>
impl<H> HandlerManager<H>
where
H: Clone,
{