mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 04:25:21 +00:00
device_manager: use if let to drop single match
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
4f05b8463c
commit
277cfd07ba
@ -3445,24 +3445,20 @@ impl DeviceManager {
|
|||||||
.map_err(DeviceManagerError::UpdateMemoryForVfioPciDevice)?;
|
.map_err(DeviceManagerError::UpdateMemoryForVfioPciDevice)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::single_match)]
|
|
||||||
// Take care of updating the memory for vfio-user devices.
|
// Take care of updating the memory for vfio-user devices.
|
||||||
{
|
{
|
||||||
let device_tree = self.device_tree.lock().unwrap();
|
let device_tree = self.device_tree.lock().unwrap();
|
||||||
for pci_device_node in device_tree.pci_devices() {
|
for pci_device_node in device_tree.pci_devices() {
|
||||||
match pci_device_node
|
if let PciDeviceHandle::VfioUser(vfio_user_pci_device) = pci_device_node
|
||||||
.pci_device_handle
|
.pci_device_handle
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or(DeviceManagerError::MissingPciDevice)?
|
.ok_or(DeviceManagerError::MissingPciDevice)?
|
||||||
{
|
{
|
||||||
PciDeviceHandle::VfioUser(vfio_user_pci_device) => {
|
vfio_user_pci_device
|
||||||
vfio_user_pci_device
|
.lock()
|
||||||
.lock()
|
.unwrap()
|
||||||
.unwrap()
|
.dma_map(new_region)
|
||||||
.dma_map(new_region)
|
.map_err(DeviceManagerError::UpdateMemoryForVfioUserPciDevice)?;
|
||||||
.map_err(DeviceManagerError::UpdateMemoryForVfioUserPciDevice)?;
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user