device_manager: use if let to drop single match

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2022-01-18 15:46:20 +00:00 committed by Bo Chen
parent 4f05b8463c
commit 277cfd07ba

View File

@ -3445,24 +3445,20 @@ impl DeviceManager {
.map_err(DeviceManagerError::UpdateMemoryForVfioPciDevice)?;
}
#[allow(clippy::single_match)]
// Take care of updating the memory for vfio-user devices.
{
let device_tree = self.device_tree.lock().unwrap();
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
.as_ref()
.ok_or(DeviceManagerError::MissingPciDevice)?
{
PciDeviceHandle::VfioUser(vfio_user_pci_device) => {
vfio_user_pci_device
.lock()
.unwrap()
.dma_map(new_region)
.map_err(DeviceManagerError::UpdateMemoryForVfioUserPciDevice)?;
}
_ => {}
vfio_user_pci_device
.lock()
.unwrap()
.dma_map(new_region)
.map_err(DeviceManagerError::UpdateMemoryForVfioUserPciDevice)?;
}
}
}