mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +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:
parent
c9983ff4ad
commit
4f05b8463c
@ -295,14 +295,13 @@ impl VsockEpollListener for VsockMuxer {
|
||||
'epoll: loop {
|
||||
match epoll::wait(self.epoll_file.as_raw_fd(), 0, epoll_events.as_mut_slice()) {
|
||||
Ok(ev_cnt) => {
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
for i in 0..ev_cnt {
|
||||
for evt in epoll_events.iter().take(ev_cnt) {
|
||||
self.handle_event(
|
||||
epoll_events[i].data as RawFd,
|
||||
// It's ok to unwrap here, since the `epoll_events[i].events` is filled
|
||||
evt.data as RawFd,
|
||||
// It's ok to unwrap here, since the `evt.events` is filled
|
||||
// in by `epoll::wait()`, and therefore contains only valid epoll
|
||||
// flags.
|
||||
epoll::Events::from_bits(epoll_events[i].events).unwrap(),
|
||||
epoll::Events::from_bits(evt.events).unwrap(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user