From b16fdb1b3ac66e954b55cbb3667fc2435dc1b833 Mon Sep 17 00:00:00 2001 From: Gaelan Steele Date: Sun, 28 Mar 2021 23:15:34 -0700 Subject: [PATCH] virtio-devices: use Option::map It's more concise, more idiomatic Rust, and satisfies nightly clippy. Signed-off-by: Gaelan Steele --- virtio-devices/src/vhost_user/fs.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/virtio-devices/src/vhost_user/fs.rs b/virtio-devices/src/vhost_user/fs.rs index 2f8040fe7..1cd566166 100644 --- a/virtio-devices/src/vhost_user/fs.rs +++ b/virtio-devices/src/vhost_user/fs.rs @@ -538,11 +538,7 @@ impl VirtioDevice for Fs { } fn get_shm_regions(&self) -> Option { - if let Some(cache) = self.cache.as_ref() { - Some(cache.0.clone()) - } else { - None - } + self.cache.as_ref().map(|cache| cache.0.clone()) } fn set_shm_regions(