Skip to content
Myr

Extract ExitCode::is_error helper

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by fusillicode · committed by David Peter · parent b23cfc3 · Browse files · 1 file+8 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−4 removed

  • other:+8 added−4 removed

1 file+8 added−4 removed

modified:src/exit_codes.rs+8 added-4 removed
14 unmodified lines
15}1617impl ExitCode {18 pub fn error_if_any_error(results: Vec<Self>) -> Self {19 if results.iter().any(|s| match s {20 ExitCode::GeneralError => true,21 _ => false,22 }) {19 if results.iter().any(ExitCode::is_error) {20 return ExitCode::GeneralError;21 }22 ExitCode::Success23 }2425 fn is_error(&self) -> bool {26 match self {27 ExitCode::GeneralError | ExitCode::KilledBySigint => true,28 _ => false,29 }30 }31}