Skip to content

Commit

Permalink
feat: Add use of bool::then in sys/unix/process
Browse files Browse the repository at this point in the history
Remove else { None } in favor of using bool::then()
  • Loading branch information
wcampbell0x2a committed Mar 17, 2022
1 parent 58f1179 commit b1f3179
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/std/src/sys/unix/process/process_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,19 +648,19 @@ 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 {
libc::WIFSIGNALED(self.0) && libc::WCOREDUMP(self.0)
}

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 {
Expand Down

0 comments on commit b1f3179

Please sign in to comment.