Clean up naga's xtask a bit (#7014)

This commit is contained in:
Erich Gubler
2025-01-28 11:26:38 -05:00
committed by GitHub
parent b245b358f5
commit 65d499f302
3 changed files with 1 additions and 35 deletions

View File

@@ -16,7 +16,6 @@ mod glob;
mod jobserver;
mod path;
mod process;
mod result;
mod validate;
fn main() -> ExitCode {

View File

@@ -1,33 +0,0 @@
#[derive(Clone, Copy, Debug)]
pub(crate) enum ErrorStatus {
NoFailuresFound,
OneOrMoreFailuresFound,
}
impl ErrorStatus {
pub(crate) fn merge(self, other: Self) -> Self {
match (self, other) {
(Self::OneOrMoreFailuresFound, _) | (_, Self::OneOrMoreFailuresFound) => {
Self::OneOrMoreFailuresFound
}
(Self::NoFailuresFound, Self::NoFailuresFound) => Self::NoFailuresFound,
}
}
}
pub(crate) trait LogIfError<T> {
fn log_if_err_found(self, status: &mut ErrorStatus) -> Option<T>;
}
impl<T> LogIfError<T> for anyhow::Result<T> {
fn log_if_err_found(self, status: &mut ErrorStatus) -> Option<T> {
match self {
Ok(t) => Some(t),
Err(e) => {
log::error!("{e:?}");
*status = status.merge(ErrorStatus::OneOrMoreFailuresFound);
None
}
}
}
}

View File

@@ -26,7 +26,7 @@ pub(crate) fn validate(cmd: ValidateSubcommand) -> anyhow::Result<()> {
for job in jobs {
let tx_results = tx_results.clone();
crate::jobserver::start_job_thread(move || {
let result = match std::panic::catch_unwind(|| job()) {
let result = match std::panic::catch_unwind(job) {
Ok(result) => result,
Err(payload) => Err(match payload.downcast_ref::<&str>() {
Some(message) => {