virtio-devices: use Option::map

It's more concise, more idiomatic Rust, and satisfies nightly clippy.

Signed-off-by: Gaelan Steele <gbs@canishe.com>
This commit is contained in:
Gaelan Steele 2021-03-28 23:15:34 -07:00 committed by Sebastien Boeuf
parent d72d7fd93c
commit b16fdb1b3a

View File

@ -538,11 +538,7 @@ impl VirtioDevice for Fs {
}
fn get_shm_regions(&self) -> Option<VirtioSharedMemoryList> {
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(