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

Remove else { None } in favor of using bool::then()
This commit is contained in:
wcampbell 2022-03-17 19:12:09 -04:00
parent 58f11791af
commit b1f3179804

View File

@ -648,11 +648,11 @@ pub fn exit_ok(&self) -> Result<(), ExitStatusError> {
}
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 @@ pub fn core_dumped(&self) -> bool {
}
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 {