From a438a214ad696046d6ebffbed7e25e48b3f9754d Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Mon, 19 Aug 2024 10:07:10 +0900 Subject: [PATCH] fix clippy warnings --- build.rs | 3 +-- src/unix/bsd/apple/mod.rs | 6 +++--- src/unix/bsd/mod.rs | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/build.rs b/build.rs index 60dda363c7830..ead9cda6f011c 100644 --- a/build.rs +++ b/build.rs @@ -132,7 +132,6 @@ fn rustc_minor_nightly() -> (u32, bool) { let output = cmd .arg("--version") .output() - .ok() .expect("Failed to get rustc version"); if !output.status.success() { panic!( @@ -198,7 +197,7 @@ fn emcc_version_code() -> Option { // Some Emscripten versions come with `-git` attached, so split the // version string also on the `-` char. - let mut pieces = version.trim().split(|c| c == '.' || c == '-'); + let mut pieces = version.trim().split(['.', '-']); let major = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0); let minor = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0); diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 9951f2314153d..758e069f05ce4 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -5508,11 +5508,11 @@ f! { return ::CMSG_FIRSTHDR(mhdr); }; let cmsg_len = (*cmsg).cmsg_len as usize; - let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len as usize); + let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; if next + __DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) > max { - 0 as *mut ::cmsghdr + core::ptr::null_mut() } else { next as *mut ::cmsghdr } @@ -5520,7 +5520,7 @@ f! { pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar { (cmsg as *mut ::c_uchar) - .offset(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) as isize) + .add(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>())) } pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 83e675ca3474d..69a98e1c7e3db 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -546,7 +546,7 @@ f! { if (*mhdr).msg_controllen as usize >= ::mem::size_of::<::cmsghdr>() { (*mhdr).msg_control as *mut ::cmsghdr } else { - 0 as *mut ::cmsghdr + core::ptr::null_mut() } }