Rollup merge of #95058 - wcampbell0x2a:use-then-in-unix-process, r=dtolnay

Add use of bool::then in sys/unix/process

Remove `else { None }` in favor of using `bool::then()`
This commit is contained in:
Matthias Krüger 2022-03-18 21:50:49 +01:00 committed by GitHub
commit c8cf9e3a8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -648,11 +648,11 @@ impl ExitStatus {
}
pub fn code(&self) -> Option<i32> {
if self.exited() { Some(libc::WEXITSTATUS(self.0)) } else { None }
self.exited().then(|| libc::WEXITSTATUS(self.0))
}
pub fn signal(&self) -> Option<i32> {
if libc::WIFSIGNALED(self.0) { Some(libc::WTERMSIG(self.0)) } else { None }
libc::WIFSIGNALED(self.0).then(|| libc::WTERMSIG(self.0))
}
pub fn core_dumped(&self) -> bool {
@ -660,7 +660,7 @@ impl ExitStatus {
}
pub fn stopped_signal(&self) -> Option<i32> {
if libc::WIFSTOPPED(self.0) { Some(libc::WSTOPSIG(self.0)) } else { None }
libc::WIFSTOPPED(self.0).then(|| libc::WSTOPSIG(self.0))
}
pub fn continued(&self) -> bool {