Rollup merge of #88286 - LeSeulArtichaut:unnecessary-unsafe-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: #88260.
This commit is contained in:
Manish Goregaokar 2021-10-03 23:13:18 -07:00 committed by GitHub
commit f2ec71fe74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -552,8 +552,7 @@ impl Process {
use crate::os::unix::io::FromRawFd; use crate::os::unix::io::FromRawFd;
use crate::sys_common::FromInner; use crate::sys_common::FromInner;
// Safety: If `pidfd` is nonnegative, we assume it's valid and otherwise unowned. // Safety: If `pidfd` is nonnegative, we assume it's valid and otherwise unowned.
let pidfd = (pidfd >= 0) let pidfd = (pidfd >= 0).then(|| PidFd::from_inner(sys::fd::FileDesc::from_raw_fd(pidfd)));
.then(|| PidFd::from_inner(unsafe { sys::fd::FileDesc::from_raw_fd(pidfd) }));
Process { pid, status: None, pidfd } Process { pid, status: None, pidfd }
} }