Skip to content

Commit

Permalink
Rollup merge of rust-lang#88286 - LeSeulArtichaut:unnecessary-unsafe-…
Browse files Browse the repository at this point in the history
…block-std, r=dtolnay

Remove unnecessary unsafe block in `process_unix`

Because it's nested under this unsafe fn!

This block isn't detected as unnecessary because of a bug in the compiler: rust-lang#88260.
  • Loading branch information
Manishearth authored Oct 4, 2021
2 parents e500f1c + 22112e4 commit f2ec71f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions library/std/src/sys/unix/process/process_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,7 @@ impl Process {
use crate::os::unix::io::FromRawFd;
use crate::sys_common::FromInner;
// Safety: If `pidfd` is nonnegative, we assume it's valid and otherwise unowned.
let pidfd = (pidfd >= 0)
.then(|| PidFd::from_inner(unsafe { sys::fd::FileDesc::from_raw_fd(pidfd) }));
let pidfd = (pidfd >= 0).then(|| PidFd::from_inner(sys::fd::FileDesc::from_raw_fd(pidfd)));
Process { pid, status: None, pidfd }
}

Expand Down

0 comments on commit f2ec71f

Please sign in to comment.