diff options
| author | Lieselotte <52315535+she3py@users.noreply.github.com> | 2024-09-19 14:22:50 +0200 |
|---|---|---|
| committer | Lieselotte <52315535+she3py@users.noreply.github.com> | 2024-09-19 14:22:50 +0200 |
| commit | dc628c8ecb8d24f88850894e01e7bd027cc9af61 (patch) | |
| tree | 02cd67f228253b39e7ba1de28ee03054e7f6ac88 /library/std/src | |
| parent | b7b9453ea7354ee39b15390ffd0b4f9e2000076b (diff) | |
| download | rust-dc628c8ecb8d24f88850894e01e7bd027cc9af61.tar.gz rust-dc628c8ecb8d24f88850894e01e7bd027cc9af61.zip | |
`pal::unsupported::process::ExitCode`: use an `u8` instead of a `bool`
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/sys/pal/unsupported/process.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/library/std/src/sys/pal/unsupported/process.rs b/library/std/src/sys/pal/unsupported/process.rs index 40231bfc90b..fee81744f09 100644 --- a/library/std/src/sys/pal/unsupported/process.rs +++ b/library/std/src/sys/pal/unsupported/process.rs @@ -255,11 +255,11 @@ impl ExitStatusError { } #[derive(PartialEq, Eq, Clone, Copy, Debug)] -pub struct ExitCode(bool); +pub struct ExitCode(u8); impl ExitCode { - pub const SUCCESS: ExitCode = ExitCode(false); - pub const FAILURE: ExitCode = ExitCode(true); + pub const SUCCESS: ExitCode = ExitCode(0); + pub const FAILURE: ExitCode = ExitCode(1); pub fn as_i32(&self) -> i32 { self.0 as i32 @@ -268,10 +268,7 @@ impl ExitCode { impl From<u8> for ExitCode { fn from(code: u8) -> Self { - match code { - 0 => Self::SUCCESS, - 1..=255 => Self::FAILURE, - } + Self(code) } } |
