mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
pci: Fix clippy: use mem::take instead of drain().collect()
```
warning: you seem to be trying to move all elements into a new `Vec`
--> pci/src/configuration.rs:951:24
|
951 | return self.pending_bar_reprogram.drain(..).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `mem::take` to avoid creating a new allocation: `std::mem::take(&mut self.pending_bar_reprogram)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#drain_collect
= note: `-D clippy::drain-collect` implied by `-D clippy::all`
```
Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
|
||||
|
||||
use std::result;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::{mem, result};
|
||||
|
||||
use byteorder::{ByteOrder, LittleEndian};
|
||||
use log::{info, warn};
|
||||
@@ -948,7 +948,7 @@ impl PciConfiguration {
|
||||
"BAR reprogramming parameter is returned: {:x?}",
|
||||
self.pending_bar_reprogram
|
||||
);
|
||||
return self.pending_bar_reprogram.drain(..).collect();
|
||||
return mem::take(&mut self.pending_bar_reprogram);
|
||||
}
|
||||
info!(
|
||||
"MSE bit is disabled. No BAR reprogramming parameter is returned: {:x?}",
|
||||
|
||||
Reference in New Issue
Block a user