From 277cfd07baeff9cb17c703ded10943d0c5040a25 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Tue, 18 Jan 2022 15:46:20 +0000 Subject: [PATCH] device_manager: use if let to drop single match Signed-off-by: Wei Liu --- vmm/src/device_manager.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index 11d462feb..8113af100 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -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)?; } } }