Skip to content

Commit a769a2a

Browse files
committed
refactor(iovec): use Self::default
`Self::default()` is a bit more compact. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 68db342 commit a769a2a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/vmm/src/devices/virtio/iovec.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,8 @@ impl IoVecBuffer {
9797
///
9898
/// The descriptor chain cannot be referencing the same memory location as another chain
9999
pub unsafe fn from_descriptor_chain(head: DescriptorChain) -> Result<Self, IoVecError> {
100-
let mut new_buffer: Self = Default::default();
101-
100+
let mut new_buffer = Self::default();
102101
new_buffer.load_descriptor_chain(head)?;
103-
104102
Ok(new_buffer)
105103
}
106104

@@ -275,10 +273,8 @@ impl IoVecBufferMut {
275273
///
276274
/// The descriptor chain cannot be referencing the same memory location as another chain
277275
pub unsafe fn from_descriptor_chain(head: DescriptorChain) -> Result<Self, IoVecError> {
278-
let mut new_buffer: Self = Default::default();
279-
276+
let mut new_buffer = Self::default();
280277
new_buffer.load_descriptor_chain(head)?;
281-
282278
Ok(new_buffer)
283279
}
284280

0 commit comments

Comments
 (0)