summary refs log tree commit diff
path: root/devices/src/virtio/wl.rs
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@chromium.org>2019-04-15 16:58:42 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-18 19:51:01 -0700
commitdc4effa72b214bc3bd14ca2f7772ab1b728aef5b (patch)
tree61c308a8c165a6fbe65f947da4abd241a9dd265d /devices/src/virtio/wl.rs
parent64cd5eae5778b86f6e498a6fa1b1962693aa5a46 (diff)
downloadcrosvm-dc4effa72b214bc3bd14ca2f7772ab1b728aef5b.tar
crosvm-dc4effa72b214bc3bd14ca2f7772ab1b728aef5b.tar.gz
crosvm-dc4effa72b214bc3bd14ca2f7772ab1b728aef5b.tar.bz2
crosvm-dc4effa72b214bc3bd14ca2f7772ab1b728aef5b.tar.lz
crosvm-dc4effa72b214bc3bd14ca2f7772ab1b728aef5b.tar.xz
crosvm-dc4effa72b214bc3bd14ca2f7772ab1b728aef5b.tar.zst
crosvm-dc4effa72b214bc3bd14ca2f7772ab1b728aef5b.zip
clippy: Iterate without calling .iter()
See:
https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
https://rust-lang.github.io/rust-clippy/master/index.html#explicit_into_iter_loop

Before:

    for element in slice.iter() {...}

After:

    for element in slice {...}

TEST=grep -r '\.iter() {'
TEST=grep -r '\.iter_mut() {'
TEST=grep -r '\.into_iter() {'
TEST=cargo check --all-features
TEST=local kokoro

Change-Id: I27f0df7cfa1064b2c8b162cba263513926a433a9
Reviewed-on: https://chromium-review.googlesource.com/1568525
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>
Diffstat (limited to 'devices/src/virtio/wl.rs')
-rw-r--r--devices/src/virtio/wl.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/devices/src/virtio/wl.rs b/devices/src/virtio/wl.rs
index 3bc9c07..77ee136 100644
--- a/devices/src/virtio/wl.rs
+++ b/devices/src/virtio/wl.rs
@@ -1187,7 +1187,7 @@ impl WlState {
 
     fn close(&mut self, vfd_id: u32) -> WlResult<WlResp> {
         let mut to_delete = Set::new();
-        for (dest_vfd_id, q) in self.in_queue.iter() {
+        for (dest_vfd_id, q) in &self.in_queue {
             if *dest_vfd_id == vfd_id {
                 if let WlRecv::Vfd { id } = q {
                     to_delete.insert(*id);
@@ -1226,7 +1226,7 @@ impl WlState {
             vfds.copy_to(&mut vfd_ids[..]);
             send_vfd_ids[..vfd_count]
                 .iter_mut()
-                .zip(vfd_ids[..vfd_count].iter())
+                .zip(&vfd_ids[..vfd_count])
                 .for_each(|(send_vfd_id, &vfd_id)| {
                     *send_vfd_id = CtrlVfdSendVfd {
                         kind: Le32::from(VIRTIO_WL_CTRL_VFD_SEND_KIND_LOCAL),
@@ -1551,7 +1551,7 @@ impl Worker {
                 }
             };
 
-            for event in events.iter() {
+            for event in &events {
                 match event.token() {
                     Token::InQueue => {
                         let _ = in_queue_evt.read();