Skip to content

Commit

Permalink
fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowone committed Aug 19, 2024
1 parent 5375260 commit a438a21
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down Expand Up @@ -198,7 +197,7 @@ fn emcc_version_code() -> Option<u64> {

// 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);
Expand Down
6 changes: 3 additions & 3 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5508,19 +5508,19 @@ 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
}
}

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 {
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down

0 comments on commit a438a21

Please sign in to comment.