Skip to content

Commit 291b2a3

Browse files
youknowonetgross35
authored andcommitted
fix clippy warnings
(backport <#3855>) (cherry picked from commit a438a21)
1 parent f9aa12d commit 291b2a3

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

build.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ fn rustc_minor_nightly() -> (u32, bool) {
216216
let output = cmd
217217
.arg("--version")
218218
.output()
219-
.ok()
220219
.expect("Failed to get rustc version");
221220
if !output.status.success() {
222221
panic!(
@@ -296,7 +295,7 @@ fn emcc_version_code() -> Option<u64> {
296295

297296
// Some Emscripten versions come with `-git` attached, so split the
298297
// version string also on the `-` char.
299-
let mut pieces = version.trim().split(|c| c == '.' || c == '-');
298+
let mut pieces = version.trim().split(['.', '-']);
300299

301300
let major = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
302301
let minor = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);

src/unix/bsd/apple/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5564,19 +5564,19 @@ f! {
55645564
return ::CMSG_FIRSTHDR(mhdr);
55655565
};
55665566
let cmsg_len = (*cmsg).cmsg_len as usize;
5567-
let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len as usize);
5567+
let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len);
55685568
let max = (*mhdr).msg_control as usize
55695569
+ (*mhdr).msg_controllen as usize;
55705570
if next + __DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) > max {
5571-
0 as *mut ::cmsghdr
5571+
core::ptr::null_mut()
55725572
} else {
55735573
next as *mut ::cmsghdr
55745574
}
55755575
}
55765576

55775577
pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
55785578
(cmsg as *mut ::c_uchar)
5579-
.offset(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) as isize)
5579+
.add(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()))
55805580
}
55815581

55825582
pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {

src/unix/bsd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ f! {
548548
if (*mhdr).msg_controllen as usize >= ::mem::size_of::<::cmsghdr>() {
549549
(*mhdr).msg_control as *mut ::cmsghdr
550550
} else {
551-
0 as *mut ::cmsghdr
551+
core::ptr::null_mut()
552552
}
553553
}
554554

0 commit comments

Comments
 (0)