iterate instead of indexing using a range

This commit is contained in:
auronandace
2026-03-15 21:39:10 +00:00
parent 936fe93447
commit 25f059bf67
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ pub use drm_sys::{
drm_mode_cursor2, drm_mode_destroy_dumb, drm_mode_fb_cmd, drm_mode_fb_cmd2, drm_mode_get_blob,
drm_mode_get_connector, drm_mode_get_encoder, drm_mode_get_plane, drm_mode_get_plane_res,
drm_mode_get_property, drm_mode_map_dumb, drm_mode_modeinfo, drm_mode_obj_get_properties,
drm_mode_property_enum, drm_set_client_cap, drm_version, drm_mode_set_plane
drm_mode_property_enum, drm_mode_set_plane, drm_set_client_cap, drm_version,
};
pub const VERSION: u64 = 0;
+2 -2
View File
@@ -213,13 +213,13 @@ pub unsafe extern "C" fn inet_pton(af: c_int, src: *const c_char, dst: *mut c_vo
};
let src_cstr = unsafe { CStr::from_ptr(src) };
let mut octets = unsafe { str::from_utf8_unchecked(src_cstr.to_bytes()).split('.') };
for i in 0..4 {
for part in s_addr.iter_mut().take(4) {
if let Some(n) = octets
.next()
.filter(|x| !x.len() > 3)
.and_then(|x| u8::from_str(x).ok())
{
s_addr[i] = n;
*part = n;
} else {
return 0;
}
+2 -2
View File
@@ -66,8 +66,8 @@ pub unsafe fn poll_epoll(fds: &mut [pollfd], timeout: c_int, sigmask: *const sig
};
let mut closed = 0;
for i in 0..fds.len() {
let pfd = &mut fds[i];
for (i, fd) in fds.iter_mut().enumerate() {
let pfd = fd;
pfd.revents = 0;