mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 03:12:27 +00:00
virtio-devices: mem: Address clippy issue
error: all if blocks contain the same code at the start --> virtio-devices/src/mem.rs:508:9 | 508 | / if plug { 509 | | let handlers = self.dma_mapping_handlers.lock().unwrap(); | |_____________________________________________________________________^ | = note: `-D clippy::branches-sharing-code` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#branches_sharing_code help: consider moving the start statements out like this | 508 | let handlers = self.dma_mapping_handlers.lock().unwrap(); 509 | if plug { | Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
18012d9ee8
commit
0d3c5c966b
@ -505,8 +505,8 @@ impl MemEpollHandler {
|
||||
.unwrap()
|
||||
.set_range(first_block_index, nb_blocks, plug);
|
||||
|
||||
if plug {
|
||||
let handlers = self.dma_mapping_handlers.lock().unwrap();
|
||||
if plug {
|
||||
let mut gpa = addr;
|
||||
for _ in 0..nb_blocks {
|
||||
for (_, handler) in handlers.iter() {
|
||||
@ -524,7 +524,6 @@ impl MemEpollHandler {
|
||||
|
||||
config.plugged_size += size;
|
||||
} else {
|
||||
let handlers = self.dma_mapping_handlers.lock().unwrap();
|
||||
for (_, handler) in handlers.iter() {
|
||||
if let Err(e) = handler.unmap(addr, size) {
|
||||
error!(
|
||||
|
Loading…
x
Reference in New Issue
Block a user