mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
misc: Automatically fix cargo clippy issues added in 1.68 (beta)
Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
aaf67c9ae4
commit
574576c8e9
@ -55,7 +55,7 @@ pub struct TdvfSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug, Default)]
|
||||||
pub enum TdvfSectionType {
|
pub enum TdvfSectionType {
|
||||||
Bfv,
|
Bfv,
|
||||||
Cfv,
|
Cfv,
|
||||||
@ -64,15 +64,10 @@ pub enum TdvfSectionType {
|
|||||||
PermMem,
|
PermMem,
|
||||||
Payload,
|
Payload,
|
||||||
PayloadParam,
|
PayloadParam,
|
||||||
|
#[default]
|
||||||
Reserved = 0xffffffff,
|
Reserved = 0xffffffff,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for TdvfSectionType {
|
|
||||||
fn default() -> Self {
|
|
||||||
TdvfSectionType::Reserved
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn tdvf_descriptor_offset(file: &mut File) -> Result<(SeekFrom, bool), TdvfError> {
|
fn tdvf_descriptor_offset(file: &mut File) -> Result<(SeekFrom, bool), TdvfError> {
|
||||||
// Let's first try to identify the presence of the table footer GUID
|
// Let's first try to identify the presence of the table footer GUID
|
||||||
file.seek(SeekFrom::End(-0x30))
|
file.seek(SeekFrom::End(-0x30))
|
||||||
@ -202,21 +197,16 @@ pub fn parse_tdvf_sections(file: &mut File) -> Result<(Vec<TdvfSection>, bool),
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[repr(u16)]
|
#[repr(u16)]
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug, Default)]
|
||||||
enum HobType {
|
enum HobType {
|
||||||
Handoff = 0x1,
|
Handoff = 0x1,
|
||||||
ResourceDescriptor = 0x3,
|
ResourceDescriptor = 0x3,
|
||||||
GuidExtension = 0x4,
|
GuidExtension = 0x4,
|
||||||
|
#[default]
|
||||||
Unused = 0xfffe,
|
Unused = 0xfffe,
|
||||||
EndOfHobList = 0xffff,
|
EndOfHobList = 0xffff,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HobType {
|
|
||||||
fn default() -> Self {
|
|
||||||
HobType::Unused
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Default, Debug)]
|
#[derive(Copy, Clone, Default, Debug)]
|
||||||
struct HobHeader {
|
struct HobHeader {
|
||||||
@ -266,19 +256,14 @@ struct HobGuidType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug, Default)]
|
||||||
pub enum PayloadImageType {
|
pub enum PayloadImageType {
|
||||||
|
#[default]
|
||||||
ExecutablePayload,
|
ExecutablePayload,
|
||||||
BzImage,
|
BzImage,
|
||||||
RawVmLinux,
|
RawVmLinux,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PayloadImageType {
|
|
||||||
fn default() -> Self {
|
|
||||||
PayloadImageType::ExecutablePayload
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Default, Debug)]
|
#[derive(Copy, Clone, Default, Debug)]
|
||||||
pub struct PayloadInfo {
|
pub struct PayloadInfo {
|
||||||
|
@ -168,7 +168,6 @@ fn parse_boot_time_output(output: &[u8]) -> Result<f64, Error> {
|
|||||||
std::panic::catch_unwind(|| {
|
std::panic::catch_unwind(|| {
|
||||||
let l: Vec<String> = String::from_utf8_lossy(output)
|
let l: Vec<String> = String::from_utf8_lossy(output)
|
||||||
.lines()
|
.lines()
|
||||||
.into_iter()
|
|
||||||
.filter(|l| l.contains("Debug I/O port: Kernel code"))
|
.filter(|l| l.contains("Debug I/O port: Kernel code"))
|
||||||
.map(|l| l.to_string())
|
.map(|l| l.to_string())
|
||||||
.collect();
|
.collect();
|
||||||
|
@ -24,8 +24,9 @@ extern crate log;
|
|||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[repr(u16)]
|
#[repr(u16)]
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug, Default)]
|
||||||
enum Command {
|
enum Command {
|
||||||
|
#[default]
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
Version = 1,
|
Version = 1,
|
||||||
DmaMap = 2,
|
DmaMap = 2,
|
||||||
@ -43,28 +44,17 @@ enum Command {
|
|||||||
UserDirtyPages = 14,
|
UserDirtyPages = 14,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Command {
|
|
||||||
fn default() -> Self {
|
|
||||||
Command::Unknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
|
||||||
enum HeaderFlags {
|
enum HeaderFlags {
|
||||||
|
#[default]
|
||||||
Command = 0,
|
Command = 0,
|
||||||
Reply = 1,
|
Reply = 1,
|
||||||
NoReply = 1 << 4,
|
NoReply = 1 << 4,
|
||||||
Error = 1 << 5,
|
Error = 1 << 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HeaderFlags {
|
|
||||||
fn default() -> Self {
|
|
||||||
HeaderFlags::Command
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Default, Clone, Copy, Debug)]
|
#[derive(Default, Clone, Copy, Debug)]
|
||||||
struct Header {
|
struct Header {
|
||||||
|
@ -127,18 +127,13 @@ pub struct MemoryZoneConfig {
|
|||||||
pub prefault: bool,
|
pub prefault: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize, Default)]
|
||||||
pub enum HotplugMethod {
|
pub enum HotplugMethod {
|
||||||
|
#[default]
|
||||||
Acpi,
|
Acpi,
|
||||||
VirtioMem,
|
VirtioMem,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HotplugMethod {
|
|
||||||
fn default() -> Self {
|
|
||||||
HotplugMethod::Acpi
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn default_memoryconfig_thp() -> bool {
|
fn default_memoryconfig_thp() -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
@ -188,18 +183,13 @@ impl Default for MemoryConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, Default)]
|
||||||
pub enum VhostMode {
|
pub enum VhostMode {
|
||||||
|
#[default]
|
||||||
Client,
|
Client,
|
||||||
Server,
|
Server,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for VhostMode {
|
|
||||||
fn default() -> Self {
|
|
||||||
VhostMode::Client
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
|
||||||
pub struct DiskConfig {
|
pub struct DiskConfig {
|
||||||
pub path: Option<PathBuf>,
|
pub path: Option<PathBuf>,
|
||||||
|
Loading…
Reference in New Issue
Block a user