misc: Fix beta clippy issues

Fixed with 'cargo clippy --fix' mostly.

Signed-off-by: Bo Chen <bchen@crusoe.ai>
This commit is contained in:
Bo Chen 2025-09-17 00:01:47 +00:00
parent 10fb713218
commit f122398262
3 changed files with 10 additions and 26 deletions

View file

@ -1094,8 +1094,7 @@ mod unit_tests {
#[test]
fn test_valid_vm_config_memory() {
vec![
(
[(
vec!["cloud-hypervisor", "--kernel", "/path/to/kernel", "--memory", "size=1073741824"],
r#"{
"payload": {"kernel": "/path/to/kernel"},
@ -1150,8 +1149,7 @@ mod unit_tests {
"memory": {"size": 1073741824, "hotplug_method": "VirtioMem", "hotplug_size": 1073741824}
}"#,
true,
),
]
)]
.iter()
.for_each(|(cli, openapi, equal)| {
compare_vm_config_cli_vs_json(cli, openapi, *equal);
@ -1302,7 +1300,7 @@ mod unit_tests {
#[test]
fn test_valid_vm_config_net() {
vec![
[
// This test is expected to fail because the default MAC address is
// randomly generated. There's no way we can have twice the same
// default value.
@ -1780,7 +1778,7 @@ mod unit_tests {
#[test]
#[cfg(target_arch = "x86_64")]
fn test_valid_vm_config_devices() {
vec![
[
(
vec![
"cloud-hypervisor",

View file

@ -1229,18 +1229,14 @@ impl Guest {
}
}
#[derive(Default)]
pub enum VerbosityLevel {
#[default]
Warn,
Info,
Debug,
}
impl Default for VerbosityLevel {
fn default() -> Self {
Self::Warn
}
}
impl Display for VerbosityLevel {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use VerbosityLevel::*;

View file

@ -50,8 +50,9 @@ use crate::MigratableError;
// The source can at any time send an "abandon request" to cancel
#[repr(u16)]
#[derive(Copy, Clone)]
#[derive(Copy, Clone, Default)]
pub enum Command {
#[default]
Invalid,
Start,
Config,
@ -62,12 +63,6 @@ pub enum Command {
MemoryFd,
}
impl Default for Command {
fn default() -> Self {
Self::Invalid
}
}
#[repr(C)]
#[derive(Default, Copy, Clone)]
pub struct Request {
@ -139,19 +134,14 @@ impl Request {
}
#[repr(u16)]
#[derive(Copy, Clone, PartialEq, Eq)]
#[derive(Copy, Clone, PartialEq, Eq, Default)]
pub enum Status {
#[default]
Invalid,
Ok,
Error,
}
impl Default for Status {
fn default() -> Self {
Self::Invalid
}
}
#[repr(C)]
#[derive(Default, Copy, Clone)]
pub struct Response {