From 698cd1cb3713cf39f0bd3d0a1f86a471865fbd0c Mon Sep 17 00:00:00 2001 From: Li Zebin Date: Thu, 3 Aug 2023 01:35:02 +0800 Subject: [PATCH] vsock: Replace while let with for to fit in clippy demands. clippy complains about the while let loop, so we change it to for loop to fit in the demands. Signed-off-by: Li Zebin --- crates/vsock/src/vhu_vsock_thread.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/vsock/src/vhu_vsock_thread.rs b/crates/vsock/src/vhu_vsock_thread.rs index 37e50b7bf..30494b84d 100644 --- a/crates/vsock/src/vhu_vsock_thread.rs +++ b/crates/vsock/src/vhu_vsock_thread.rs @@ -453,11 +453,11 @@ impl VhostUserVsockThread { let queue = vring_mut.get_queue_mut(); - let mut queue_iter = queue + let queue_iter = queue .iter(atomic_mem.memory()) .map_err(|_| Error::IterateQueue)?; - while let Some(mut avail_desc) = queue_iter.next() { + for mut avail_desc in queue_iter { used_any = true; let mem = atomic_mem.clone().memory(); @@ -611,11 +611,11 @@ impl VhostUserVsockThread { let queue = vring_mut.get_queue_mut(); - let mut queue_iter = queue + let queue_iter = queue .iter(atomic_mem.memory()) .map_err(|_| Error::IterateQueue)?; - while let Some(mut avail_desc) = queue_iter.next() { + for mut avail_desc in queue_iter { used_any = true; let mem = atomic_mem.clone().memory();