std: unix process_unsupported: Provide a wait status emulation (fmt)

Worsify formatting as required by rustfmt.
This commit is contained in:
Ian Jackson 2023-08-22 19:02:06 +01:00
parent 9738a07f98
commit 2727f82526

View File

@ -37,20 +37,12 @@ impl ExitStatus {
// Likewise the macros disregard all the high bits, so are happy to declare // Likewise the macros disregard all the high bits, so are happy to declare
// out-of-range values to be WIFEXITED, WIFSTOPPED, etc. // out-of-range values to be WIFEXITED, WIFSTOPPED, etc.
let w = self.wait_status; let w = self.wait_status;
if (w & 0x7f) == 0 { if (w & 0x7f) == 0 { Some((w & 0xff00) >> 8) } else { None }
Some((w & 0xff00) >> 8)
} else {
None
}
} }
pub fn signal(&self) -> Option<i32> { pub fn signal(&self) -> Option<i32> {
let signal = self.wait_status & 0x007f; let signal = self.wait_status & 0x007f;
if signal > 0 && signal < 0x7f { if signal > 0 && signal < 0x7f { Some(signal) } else { None }
Some(signal)
} else {
None
}
} }
pub fn core_dumped(&self) -> bool { pub fn core_dumped(&self) -> bool {
@ -59,11 +51,7 @@ impl ExitStatus {
pub fn stopped_signal(&self) -> Option<i32> { pub fn stopped_signal(&self) -> Option<i32> {
let w = self.wait_status; let w = self.wait_status;
if (w & 0xff) == 0x7f { if (w & 0xff) == 0x7f { Some((w & 0xff00) >> 8) } else { None }
Some((w & 0xff00) >> 8)
} else {
None
}
} }
pub fn continued(&self) -> bool { pub fn continued(&self) -> bool {