mirror of
https://github.com/sharkdp/fd
synced 2024-07-25 04:14:33 +00:00
Extract ExitCode::is_error helper
This commit is contained in:
parent
b23cfc383f
commit
a5fe138a25
|
@ -16,12 +16,16 @@ impl Into<i32> for ExitCode {
|
|||
|
||||
impl ExitCode {
|
||||
pub fn error_if_any_error(results: Vec<Self>) -> Self {
|
||||
if results.iter().any(|s| match s {
|
||||
ExitCode::GeneralError => true,
|
||||
_ => false,
|
||||
}) {
|
||||
if results.iter().any(ExitCode::is_error) {
|
||||
return ExitCode::GeneralError;
|
||||
}
|
||||
ExitCode::Success
|
||||
}
|
||||
|
||||
fn is_error(&self) -> bool {
|
||||
match self {
|
||||
ExitCode::GeneralError | ExitCode::KilledBySigint => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue