style: Migrate to stable-only rustfmt configuration
- Remove nightly-only features from .rustfmt.toml and vendor/ss58-registry/rustfmt.toml - Removed features: imports_granularity, wrap_comments, comment_width, reorder_impl_items, spaces_around_ranges, binop_separator, match_arm_blocks, trailing_semicolon, trailing_comma - Format all 898 affected files with stable rustfmt - Ensures long-term reliability without nightly toolchain dependency
This commit is contained in:
@@ -243,8 +243,8 @@ impl Artifacts {
|
||||
let Some(file_name) = path.file_name().and_then(|f| f.to_str()) else { continue };
|
||||
if path.is_dir() && file_name.starts_with(WORKER_DIR_PREFIX) {
|
||||
let _ = fs::remove_dir_all(path);
|
||||
} else if path.extension().map_or(false, |ext| ext == ARTIFACT_EXTENSION) ||
|
||||
file_name.starts_with(ARTIFACT_OLD_PREFIX)
|
||||
} else if path.extension().map_or(false, |ext| ext == ARTIFACT_EXTENSION)
|
||||
|| file_name.starts_with(ARTIFACT_OLD_PREFIX)
|
||||
{
|
||||
let _ = fs::remove_file(path);
|
||||
}
|
||||
|
||||
@@ -524,14 +524,16 @@ async fn handle_job_finish(
|
||||
)
|
||||
},
|
||||
|
||||
Err(WorkerInterfaceError::InternalError(err)) |
|
||||
Err(WorkerInterfaceError::WorkerError(WorkerError::InternalError(err))) =>
|
||||
(None, Err(ValidationError::Internal(err)), None, None, None),
|
||||
Err(WorkerInterfaceError::InternalError(err))
|
||||
| Err(WorkerInterfaceError::WorkerError(WorkerError::InternalError(err))) => {
|
||||
(None, Err(ValidationError::Internal(err)), None, None, None)
|
||||
},
|
||||
// Either the worker or the job timed out. Kill the worker in either case. Treated as
|
||||
// definitely-invalid, because if we timed out, there's no time left for a retry.
|
||||
Err(WorkerInterfaceError::HardTimeout) |
|
||||
Err(WorkerInterfaceError::WorkerError(WorkerError::JobTimedOut)) =>
|
||||
(None, Err(ValidationError::Invalid(InvalidCandidate::HardTimeout)), None, None, None),
|
||||
Err(WorkerInterfaceError::HardTimeout)
|
||||
| Err(WorkerInterfaceError::WorkerError(WorkerError::JobTimedOut)) => {
|
||||
(None, Err(ValidationError::Invalid(InvalidCandidate::HardTimeout)), None, None, None)
|
||||
},
|
||||
// "Maybe invalid" errors (will retry).
|
||||
Err(WorkerInterfaceError::CommunicationErr(_err)) => (
|
||||
None,
|
||||
|
||||
@@ -533,10 +533,12 @@ async fn handle_to_host(
|
||||
handle_execute_pvf(artifacts, prepare_queue, execute_queue, awaiting_prepare, inputs)
|
||||
.await?;
|
||||
},
|
||||
ToHost::HeadsUp { active_pvfs } =>
|
||||
handle_heads_up(artifacts, prepare_queue, active_pvfs).await?,
|
||||
ToHost::UpdateActiveLeaves { update, ancestors } =>
|
||||
handle_update_active_leaves(execute_queue, update, ancestors).await?,
|
||||
ToHost::HeadsUp { active_pvfs } => {
|
||||
handle_heads_up(artifacts, prepare_queue, active_pvfs).await?
|
||||
},
|
||||
ToHost::UpdateActiveLeaves { update, ancestors } => {
|
||||
handle_update_active_leaves(execute_queue, update, ancestors).await?
|
||||
},
|
||||
#[cfg(feature = "test-utils")]
|
||||
ToHost::ReplaceArtifactChecksum { checksum, new_checksum } => {
|
||||
artifacts.replace_artifact_checksum(checksum, new_checksum);
|
||||
@@ -567,8 +569,9 @@ async fn handle_precheck_pvf(
|
||||
*last_time_needed = SystemTime::now();
|
||||
let _ = result_sender.send(Ok(()));
|
||||
},
|
||||
ArtifactState::Preparing { waiting_for_response, num_failures: _ } =>
|
||||
waiting_for_response.push(result_sender),
|
||||
ArtifactState::Preparing { waiting_for_response, num_failures: _ } => {
|
||||
waiting_for_response.push(result_sender)
|
||||
},
|
||||
ArtifactState::FailedToProcess { error, .. } => {
|
||||
// Do not retry an artifact that previously failed preparation.
|
||||
let _ = result_sender.send(PrecheckResult::Err(error.clone()));
|
||||
@@ -887,8 +890,9 @@ async fn handle_prepare_done(
|
||||
}
|
||||
|
||||
*state = match result {
|
||||
Ok(PrepareSuccess { checksum, path, size, .. }) =>
|
||||
ArtifactState::Prepared { checksum, path, last_time_needed: SystemTime::now(), size },
|
||||
Ok(PrepareSuccess { checksum, path, size, .. }) => {
|
||||
ArtifactState::Prepared { checksum, path, last_time_needed: SystemTime::now(), size }
|
||||
},
|
||||
Err(error) => {
|
||||
let last_time_failed = SystemTime::now();
|
||||
let num_failures = *num_failures + 1;
|
||||
@@ -1033,8 +1037,8 @@ fn can_retry_prepare_after_failure(
|
||||
|
||||
// Retry if the retry cooldown has elapsed and if we have already retried less than
|
||||
// `NUM_PREPARE_RETRIES` times. IO errors may resolve themselves.
|
||||
SystemTime::now() >= last_time_failed + PREPARE_FAILURE_COOLDOWN &&
|
||||
num_failures <= NUM_PREPARE_RETRIES
|
||||
SystemTime::now() >= last_time_failed + PREPARE_FAILURE_COOLDOWN
|
||||
&& num_failures <= NUM_PREPARE_RETRIES
|
||||
}
|
||||
|
||||
/// A stream that yields a pulse continuously at a given interval.
|
||||
|
||||
@@ -330,8 +330,9 @@ fn handle_mux(
|
||||
// If we receive an outcome that the worker is unreachable or that an error occurred on
|
||||
// the worker, we attempt to kill the worker process.
|
||||
match outcome {
|
||||
Outcome::Concluded { worker: idle, result } =>
|
||||
handle_concluded_no_rip(from_pool, spawned, worker, idle, result),
|
||||
Outcome::Concluded { worker: idle, result } => {
|
||||
handle_concluded_no_rip(from_pool, spawned, worker, idle, result)
|
||||
},
|
||||
// Return `Concluded`, but do not kill the worker since the error was on the host
|
||||
// side.
|
||||
Outcome::CreateTmpFileErr { worker: idle, err } => handle_concluded_no_rip(
|
||||
|
||||
@@ -271,8 +271,9 @@ async fn handle_from_pool(queue: &mut Queue, from_pool: pool::FromPool) -> Resul
|
||||
use pool::FromPool;
|
||||
match from_pool {
|
||||
FromPool::Spawned(worker) => handle_worker_spawned(queue, worker).await?,
|
||||
FromPool::Concluded { worker, rip, result } =>
|
||||
handle_worker_concluded(queue, worker, rip, result).await?,
|
||||
FromPool::Concluded { worker, rip, result } => {
|
||||
handle_worker_concluded(queue, worker, rip, result).await?
|
||||
},
|
||||
FromPool::Rip(worker) => handle_worker_rip(queue, worker).await?,
|
||||
}
|
||||
Ok(())
|
||||
|
||||
@@ -157,7 +157,7 @@ pub async fn start_work(
|
||||
|
||||
match result {
|
||||
// Received bytes from worker within the time limit.
|
||||
Ok(Ok(prepare_worker_result)) =>
|
||||
Ok(Ok(prepare_worker_result)) => {
|
||||
handle_response(
|
||||
metrics,
|
||||
IdleWorker { stream, pid, worker_dir },
|
||||
@@ -167,7 +167,8 @@ pub async fn start_work(
|
||||
&cache_path,
|
||||
preparation_timeout,
|
||||
)
|
||||
.await,
|
||||
.await
|
||||
},
|
||||
Ok(Err(err)) => {
|
||||
// Communication error within the time limit.
|
||||
gum::warn!(
|
||||
|
||||
@@ -105,8 +105,8 @@ impl FullSecurityStatus {
|
||||
}
|
||||
|
||||
fn all_errs_allowed(&self) -> bool {
|
||||
!self.partial.secure_validator_mode ||
|
||||
self.errs.iter().all(|err| err.is_allowed_in_secure_mode(&self.partial))
|
||||
!self.partial.secure_validator_mode
|
||||
|| self.errs.iter().all(|err| err.is_allowed_in_secure_mode(&self.partial))
|
||||
}
|
||||
|
||||
fn errs_string(&self) -> String {
|
||||
@@ -141,8 +141,9 @@ impl SecureModeError {
|
||||
match self {
|
||||
// Landlock is present on relatively recent Linuxes. This is optional if the unshare
|
||||
// capability is present, providing FS sandboxing a different way.
|
||||
CannotEnableLandlock { .. } =>
|
||||
security_status.can_unshare_user_namespace_and_change_root,
|
||||
CannotEnableLandlock { .. } => {
|
||||
security_status.can_unshare_user_namespace_and_change_root
|
||||
},
|
||||
// seccomp should be present on all modern Linuxes unless it's been disabled.
|
||||
CannotEnableSeccomp(_) => false,
|
||||
// Should always be present on modern Linuxes. If not, Landlock also provides FS
|
||||
|
||||
Reference in New Issue
Block a user