mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-05 13:05:45 +00:00
vfio_user: fix two clippy warnings
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
8a7f3425d8
commit
ac0aa8aa5e
@ -552,8 +552,7 @@ impl Client {
|
|||||||
cap_size,
|
cap_size,
|
||||||
reply.header.message_size - size_of::<DeviceGetRegionInfo>() as u32
|
reply.header.message_size - size_of::<DeviceGetRegionInfo>() as u32
|
||||||
);
|
);
|
||||||
let mut cap_data = Vec::with_capacity(cap_size as usize);
|
let mut cap_data = vec![0; cap_size as usize];
|
||||||
cap_data.resize(cap_data.capacity(), 0u8);
|
|
||||||
self.stream
|
self.stream
|
||||||
.read_exact(cap_data.as_mut_slice())
|
.read_exact(cap_data.as_mut_slice())
|
||||||
.map_err(Error::StreamRead)?;
|
.map_err(Error::StreamRead)?;
|
||||||
@ -770,13 +769,9 @@ impl Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn region(&self, region_index: u32) -> Option<&Region> {
|
pub fn region(&self, region_index: u32) -> Option<&Region> {
|
||||||
for region in &self.regions {
|
self.regions
|
||||||
if region.index == region_index {
|
.iter()
|
||||||
return Some(region);
|
.find(|®ion| region.index == region_index)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resettable(&self) -> bool {
|
pub fn resettable(&self) -> bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user