mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-31 18:15:20 +00:00
virtio-devices: iommu: Address clippy issue
error: usage of `contains_key` followed by `insert` on a `BTreeMap` --> virtio-devices/src/iommu.rs:439:17 | 439 | / if !mappings.contains_key(&domain) { 440 | | mappings.insert(domain, BTreeMap::new()); 441 | | } | |_________________^ help: try this: `mappings.entry(domain).or_insert_with(|| BTreeMap::new());` | = note: `-D clippy::map-entry` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
a6da5f9e77
commit
18012d9ee8
@ -436,9 +436,7 @@ impl Request {
|
||||
|
||||
// Add new domain with no mapping if the entry didn't exist yet
|
||||
let mut mappings = mapping.mappings.write().unwrap();
|
||||
if !mappings.contains_key(&domain) {
|
||||
mappings.insert(domain, BTreeMap::new());
|
||||
}
|
||||
mappings.entry(domain).or_insert_with(BTreeMap::new);
|
||||
|
||||
0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user