diff options
author | David Tolnay <dtolnay@chromium.org> | 2019-04-12 18:19:34 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-17 17:22:48 -0700 |
commit | 8b274875fb59a69be573607c3b29c63e80568ccd (patch) | |
tree | 6257357a9019d703e0b4b218f4cbeb9469fb151e | |
parent | afb1401500e4d2bab6e8af127502774c659a0af8 (diff) | |
download | crosvm-8b274875fb59a69be573607c3b29c63e80568ccd.tar crosvm-8b274875fb59a69be573607c3b29c63e80568ccd.tar.gz crosvm-8b274875fb59a69be573607c3b29c63e80568ccd.tar.bz2 crosvm-8b274875fb59a69be573607c3b29c63e80568ccd.tar.lz crosvm-8b274875fb59a69be573607c3b29c63e80568ccd.tar.xz crosvm-8b274875fb59a69be573607c3b29c63e80568ccd.tar.zst crosvm-8b274875fb59a69be573607c3b29c63e80568ccd.zip |
clippy: Resolve ptr_arg
TEST=bin/clippy Change-Id: I2880852da218bcb96c56c49977ba9d86e3156f70 Reviewed-on: https://chromium-review.googlesource.com/1566738 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
-rwxr-xr-x | bin/clippy | 1 | ||||
-rw-r--r-- | devices/src/virtio/virtio_pci_common_config.rs | 16 | ||||
-rw-r--r-- | src/plugin/process.rs | 2 |
3 files changed, 9 insertions, 10 deletions
diff --git a/bin/clippy b/bin/clippy index 148f8bb..1550288 100755 --- a/bin/clippy +++ b/bin/clippy @@ -39,7 +39,6 @@ SUPPRESS=( # To be resolved or suppressed locally. cast_ptr_alignment - ptr_arg # We don't care about these lints. Okay to remain suppressed globally. blacklisted_name diff --git a/devices/src/virtio/virtio_pci_common_config.rs b/devices/src/virtio/virtio_pci_common_config.rs index 2fef26e..7f7eaca 100644 --- a/devices/src/virtio/virtio_pci_common_config.rs +++ b/devices/src/virtio/virtio_pci_common_config.rs @@ -42,7 +42,7 @@ impl VirtioPciCommonConfig { &mut self, offset: u64, data: &mut [u8], - queues: &mut Vec<Queue>, + queues: &mut [Queue], device: &mut dyn VirtioDevice, ) { match data.len() { @@ -70,7 +70,7 @@ impl VirtioPciCommonConfig { &mut self, offset: u64, data: &[u8], - queues: &mut Vec<Queue>, + queues: &mut [Queue], device: &mut dyn VirtioDevice, ) { match data.len() { @@ -102,7 +102,7 @@ impl VirtioPciCommonConfig { } } - fn read_common_config_word(&self, offset: u64, queues: &Vec<Queue>) -> u16 { + fn read_common_config_word(&self, offset: u64, queues: &[Queue]) -> u16 { match offset { 0x10 => 0, // TODO msi-x (crbug/854765): self.msix_config, 0x12 => queues.len() as u16, // num_queues @@ -120,7 +120,7 @@ impl VirtioPciCommonConfig { } } - fn write_common_config_word(&mut self, offset: u64, value: u16, queues: &mut Vec<Queue>) { + fn write_common_config_word(&mut self, offset: u64, value: u16, queues: &mut [Queue]) { match offset { 0x10 => (), // TODO msi-x (crbug/854765): self.msix_config = value, 0x16 => self.queue_select = value, @@ -154,7 +154,7 @@ impl VirtioPciCommonConfig { &mut self, offset: u64, value: u32, - queues: &mut Vec<Queue>, + queues: &mut [Queue], device: &mut dyn VirtioDevice, ) { fn hi(v: &mut GuestAddress, x: u32) { @@ -194,7 +194,7 @@ impl VirtioPciCommonConfig { 0 // Assume the guest has no reason to read write-only registers. } - fn write_common_config_qword(&mut self, offset: u64, value: u64, queues: &mut Vec<Queue>) { + fn write_common_config_qword(&mut self, offset: u64, value: u64, queues: &mut [Queue]) { match offset { 0x20 => self.with_queue_mut(queues, |q| q.desc_table = GuestAddress(value)), 0x28 => self.with_queue_mut(queues, |q| q.avail_ring = GuestAddress(value)), @@ -205,14 +205,14 @@ impl VirtioPciCommonConfig { } } - fn with_queue<U, F>(&self, queues: &Vec<Queue>, f: F) -> Option<U> + fn with_queue<U, F>(&self, queues: &[Queue], f: F) -> Option<U> where F: FnOnce(&Queue) -> U, { queues.get(self.queue_select as usize).map(f) } - fn with_queue_mut<F: FnOnce(&mut Queue)>(&self, queues: &mut Vec<Queue>, f: F) { + fn with_queue_mut<F: FnOnce(&mut Queue)>(&self, queues: &mut [Queue], f: F) { if let Some(queue) = queues.get_mut(self.queue_select as usize) { f(queue); } diff --git a/src/plugin/process.rs b/src/plugin/process.rs index 6b05bac..1c77dee 100644 --- a/src/plugin/process.rs +++ b/src/plugin/process.rs @@ -457,7 +457,7 @@ impl Process { kvm: &Kvm, vm: &mut Vm, vcpu_handles: &[JoinHandle<()>], - taps: &Vec<Tap>, + taps: &[Tap], ) -> Result<()> { let (msg_size, request_file) = self.request_sockets[index] .recv_with_fd(&mut self.request_buffer) |