mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-12 07:32:56 +00:00
virtio-devices: Fix clippy::ptr-arg issue
error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do --> virtio-devices/src/transport/pci_common_config.rs:93:17 | 93 | queues: &mut Vec<Queue<GuestMemoryAtomic<GuestMemoryMmap>>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [Queue<GuestMemoryAtomic<GuestMemoryMmap>>]` | = note: `-D clippy::ptr-arg` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg Signed-off-by: Akira Moroo <retrage01@gmail.com>
This commit is contained in:
parent
a116add991
commit
3a6df69d45
@ -90,7 +90,7 @@ impl VirtioPciCommonConfig {
|
||||
&mut self,
|
||||
offset: u64,
|
||||
data: &mut [u8],
|
||||
queues: &mut Vec<Queue<GuestMemoryAtomic<GuestMemoryMmap>>>,
|
||||
queues: &mut [Queue<GuestMemoryAtomic<GuestMemoryMmap>>],
|
||||
device: Arc<Mutex<dyn VirtioDevice>>,
|
||||
) {
|
||||
assert!(data.len() <= 8);
|
||||
@ -120,7 +120,7 @@ impl VirtioPciCommonConfig {
|
||||
&mut self,
|
||||
offset: u64,
|
||||
data: &[u8],
|
||||
queues: &mut Vec<Queue<GuestMemoryAtomic<GuestMemoryMmap>>>,
|
||||
queues: &mut [Queue<GuestMemoryAtomic<GuestMemoryMmap>>],
|
||||
device: Arc<Mutex<dyn VirtioDevice>>,
|
||||
) {
|
||||
assert!(data.len() <= 8);
|
||||
@ -190,7 +190,7 @@ impl VirtioPciCommonConfig {
|
||||
&mut self,
|
||||
offset: u64,
|
||||
value: u16,
|
||||
queues: &mut Vec<Queue<GuestMemoryAtomic<GuestMemoryMmap>>>,
|
||||
queues: &mut [Queue<GuestMemoryAtomic<GuestMemoryMmap>>],
|
||||
) {
|
||||
debug!("write_common_config_word: offset 0x{:x}", offset);
|
||||
match offset {
|
||||
@ -256,7 +256,7 @@ impl VirtioPciCommonConfig {
|
||||
&mut self,
|
||||
offset: u64,
|
||||
value: u32,
|
||||
queues: &mut Vec<Queue<GuestMemoryAtomic<GuestMemoryMmap>>>,
|
||||
queues: &mut [Queue<GuestMemoryAtomic<GuestMemoryMmap>>],
|
||||
device: Arc<Mutex<dyn VirtioDevice>>,
|
||||
) {
|
||||
debug!("write_common_config_dword: offset 0x{:x}", offset);
|
||||
@ -304,7 +304,7 @@ impl VirtioPciCommonConfig {
|
||||
&mut self,
|
||||
offset: u64,
|
||||
value: u64,
|
||||
queues: &mut Vec<Queue<GuestMemoryAtomic<GuestMemoryMmap>>>,
|
||||
queues: &mut [Queue<GuestMemoryAtomic<GuestMemoryMmap>>],
|
||||
) {
|
||||
debug!("write_common_config_qword: offset 0x{:x}", offset);
|
||||
match offset {
|
||||
@ -330,7 +330,7 @@ impl VirtioPciCommonConfig {
|
||||
|
||||
fn with_queue_mut<F: FnOnce(&mut Queue<GuestMemoryAtomic<GuestMemoryMmap>>)>(
|
||||
&self,
|
||||
queues: &mut Vec<Queue<GuestMemoryAtomic<GuestMemoryMmap>>>,
|
||||
queues: &mut [Queue<GuestMemoryAtomic<GuestMemoryMmap>>],
|
||||
f: F,
|
||||
) {
|
||||
if let Some(queue) = queues.get_mut(self.queue_select as usize) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user