mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-21 07:21:15 +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()
|
.unwrap()
|
||||||
.set_range(first_block_index, nb_blocks, plug);
|
.set_range(first_block_index, nb_blocks, plug);
|
||||||
|
|
||||||
|
let handlers = self.dma_mapping_handlers.lock().unwrap();
|
||||||
if plug {
|
if plug {
|
||||||
let handlers = self.dma_mapping_handlers.lock().unwrap();
|
|
||||||
let mut gpa = addr;
|
let mut gpa = addr;
|
||||||
for _ in 0..nb_blocks {
|
for _ in 0..nb_blocks {
|
||||||
for (_, handler) in handlers.iter() {
|
for (_, handler) in handlers.iter() {
|
||||||
@ -524,7 +524,6 @@ impl MemEpollHandler {
|
|||||||
|
|
||||||
config.plugged_size += size;
|
config.plugged_size += size;
|
||||||
} else {
|
} else {
|
||||||
let handlers = self.dma_mapping_handlers.lock().unwrap();
|
|
||||||
for (_, handler) in handlers.iter() {
|
for (_, handler) in handlers.iter() {
|
||||||
if let Err(e) = handler.unmap(addr, size) {
|
if let Err(e) = handler.unmap(addr, size) {
|
||||||
error!(
|
error!(
|
||||||
|
Loading…
Reference in New Issue
Block a user