mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: fix clippy::needless_range_loop
Use iterator instead. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -295,14 +295,13 @@ impl VsockEpollListener for VsockMuxer {
|
|||||||
'epoll: loop {
|
'epoll: loop {
|
||||||
match epoll::wait(self.epoll_file.as_raw_fd(), 0, epoll_events.as_mut_slice()) {
|
match epoll::wait(self.epoll_file.as_raw_fd(), 0, epoll_events.as_mut_slice()) {
|
||||||
Ok(ev_cnt) => {
|
Ok(ev_cnt) => {
|
||||||
#[allow(clippy::needless_range_loop)]
|
for evt in epoll_events.iter().take(ev_cnt) {
|
||||||
for i in 0..ev_cnt {
|
|
||||||
self.handle_event(
|
self.handle_event(
|
||||||
epoll_events[i].data as RawFd,
|
evt.data as RawFd,
|
||||||
// It's ok to unwrap here, since the `epoll_events[i].events` is filled
|
// It's ok to unwrap here, since the `evt.events` is filled
|
||||||
// in by `epoll::wait()`, and therefore contains only valid epoll
|
// in by `epoll::wait()`, and therefore contains only valid epoll
|
||||||
// flags.
|
// flags.
|
||||||
epoll::Events::from_bits(epoll_events[i].events).unwrap(),
|
epoll::Events::from_bits(evt.events).unwrap(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user