mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: clippy: add if_not_else
This removes cognitive load when reading if statements. All changes were applied by clippy via `--fix`. Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
a0b72dce22
commit
0a07c96d17
+5
-7
@@ -2733,16 +2733,15 @@ impl VmConfig {
|
||||
for numa_node in numa.iter() {
|
||||
if let Some(memory_zones) = numa_node.memory_zones.clone() {
|
||||
for memory_zone in memory_zones.iter() {
|
||||
if !used_numa_node_memory_zones.contains_key(memory_zone) {
|
||||
used_numa_node_memory_zones
|
||||
.insert(memory_zone.to_string(), numa_node.guest_numa_id);
|
||||
} else {
|
||||
if used_numa_node_memory_zones.contains_key(memory_zone) {
|
||||
return Err(ValidationError::MemoryZoneReused(
|
||||
memory_zone.to_string(),
|
||||
*used_numa_node_memory_zones.get(memory_zone).unwrap(),
|
||||
numa_node.guest_numa_id,
|
||||
));
|
||||
}
|
||||
used_numa_node_memory_zones
|
||||
.insert(memory_zone.to_string(), numa_node.guest_numa_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2756,15 +2755,14 @@ impl VmConfig {
|
||||
numa_node.guest_numa_id,
|
||||
));
|
||||
}
|
||||
if !used_pci_segments.contains_key(pci_segment) {
|
||||
used_pci_segments.insert(*pci_segment, numa_node.guest_numa_id);
|
||||
} else {
|
||||
if used_pci_segments.contains_key(pci_segment) {
|
||||
return Err(ValidationError::PciSegmentReused(
|
||||
*pci_segment,
|
||||
*used_pci_segments.get(pci_segment).unwrap(),
|
||||
numa_node.guest_numa_id,
|
||||
));
|
||||
}
|
||||
used_pci_segments.insert(*pci_segment, numa_node.guest_numa_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user