mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: use Option::map and Option::cloned
It's more concise, more idiomatic Rust, and satisfies nightly clippy. Signed-off-by: Gaelan Steele <gbs@canishe.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
b16fdb1b3a
commit
b161a570ec
@@ -3136,11 +3136,9 @@ impl DeviceManager {
|
||||
}
|
||||
|
||||
pub fn interrupt_controller(&self) -> Option<Arc<Mutex<dyn InterruptController>>> {
|
||||
if let Some(interrupt_controller) = &self.interrupt_controller {
|
||||
Some(interrupt_controller.clone() as Arc<Mutex<dyn InterruptController>>)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
self.interrupt_controller
|
||||
.as_ref()
|
||||
.map(|ic| ic.clone() as Arc<Mutex<dyn InterruptController>>)
|
||||
}
|
||||
|
||||
pub fn console(&self) -> &Arc<Console> {
|
||||
|
||||
Reference in New Issue
Block a user