mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: device_manager: Rewrite if chain using match
To reflect updated clippy rules:
error: `if` chain can be rewritten with `match`
--> vmm/src/device_manager.rs:1508:25
|
1508 | / if ret > 0 {
1509 | | debug!("MSI message successfully delivered");
1510 | | } else if ret == 0 {
1511 | | warn!("failed to deliver MSI message, blocked by guest");
1512 | | }
| |_________________________^
|
= note: `-D clippy::comparison-chain` implied by `-D warnings`
= help: Consider rewriting the `if` chain to use `cmp` and `match`.
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_chain
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
committed by
Samuel Ortiz
parent
21b88c3ea0
commit
d5682cd306
@@ -34,6 +34,7 @@ use std::fs::{File, OpenOptions};
|
||||
use std::io::{self, sink, stdout};
|
||||
|
||||
use arch::layout::{APIC_START, IOAPIC_SIZE, IOAPIC_START};
|
||||
use std::cmp;
|
||||
use std::collections::HashMap;
|
||||
use std::os::unix::fs::OpenOptionsExt;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
@@ -1504,12 +1505,14 @@ impl DeviceManager {
|
||||
return vm_fd_clone
|
||||
.signal_msi(msi_queue)
|
||||
.map_err(|e| io::Error::from_raw_os_error(e.errno()))
|
||||
.map(|ret| {
|
||||
if ret > 0 {
|
||||
.map(|ret| match ret.cmp(&0) {
|
||||
cmp::Ordering::Greater => {
|
||||
debug!("MSI message successfully delivered");
|
||||
} else if ret == 0 {
|
||||
}
|
||||
cmp::Ordering::Equal => {
|
||||
warn!("failed to deliver MSI message, blocked by guest");
|
||||
}
|
||||
_ => {}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user