Skip to content

Commit 29a7f8c

Browse files
vireshkjiangliu
authored andcommitted
vhost: Fix clippy::derivable-impls warnings
Clippy warns saying: error: this `impl` can be derived Derive them instead to fix those. Signed-off-by: Viresh Kumar <[email protected]> Signed-off-by: Stefano Garzarella <[email protected]>
1 parent a48da08 commit 29a7f8c

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

crates/vhost/src/backend.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ pub struct VhostUserDirtyLogRegion {
8787

8888
/// Vhost memory access permission (VHOST_ACCESS_* mapping)
8989
#[repr(u8)]
90-
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
90+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
9191
pub enum VhostAccess {
9292
/// No access.
93+
#[default]
9394
No = 0,
9495
/// Read-Only access.
9596
ReadOnly = 1,
@@ -99,17 +100,12 @@ pub enum VhostAccess {
99100
ReadWrite = 3,
100101
}
101102

102-
impl Default for VhostAccess {
103-
fn default() -> Self {
104-
VhostAccess::No
105-
}
106-
}
107-
108103
/// Vhost IOTLB message type (VHOST_IOTLB_* mapping)
109104
#[repr(u8)]
110-
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
105+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
111106
pub enum VhostIotlbType {
112107
/// Empty message (not valid).
108+
#[default]
113109
Empty = 0,
114110
/// I/O virtual address mapping is missing or invalidated.
115111
Miss = 1,
@@ -125,12 +121,6 @@ pub enum VhostIotlbType {
125121
BatchEnd = 6,
126122
}
127123

128-
impl Default for VhostIotlbType {
129-
fn default() -> Self {
130-
VhostIotlbType::Empty
131-
}
132-
}
133-
134124
/// Vhost IOTLB message structure.
135125
#[derive(Default, Clone, Copy)]
136126
pub struct VhostIotlbMsg {

0 commit comments

Comments
 (0)