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:
Rob Bradford 2021-05-07 10:15:08 +00:00 committed by Sebastien Boeuf
parent a6da5f9e77
commit 18012d9ee8

View File

@ -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
}