Skip to content

Commit 59faab5

Browse files
branchseerclaude
andcommitted
style: apply rustfmt formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3c5a2ad commit 59faab5

5 files changed

Lines changed: 60 additions & 58 deletions

File tree

crates/vite_task/src/session/cache/display.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub enum SpawnFingerprintChange {
3939
// Working directory change
4040
/// Working directory changed
4141
CwdChanged,
42-
4342
}
4443

4544
/// Format a single spawn fingerprint change as human-readable text.

crates/vite_task/src/session/cache/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,11 @@ impl ExecutionCache {
398398
)
399399
.await?;
400400
out.write_all(b"------- pre_run_fingerprint_cache -------\n")?;
401-
self.list_table::<PreRunFingerprint, CommandCacheValue>("pre_run_fingerprint_cache", &mut out)
402-
.await?;
401+
self.list_table::<PreRunFingerprint, CommandCacheValue>(
402+
"pre_run_fingerprint_cache",
403+
&mut out,
404+
)
405+
.await?;
403406
Ok(())
404407
}
405408
}

crates/vite_task/src/session/execute/fingerprint.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,8 @@ impl PostRunFingerprint {
114114
&self,
115115
base_dir: &AbsolutePath,
116116
) -> anyhow::Result<Option<PostRunFingerprintMismatch>> {
117-
let input_mismatch = self
118-
.inferred_inputs
119-
.par_iter()
120-
.find_map_any(|(input_relative_path, path_fingerprint)| {
117+
let input_mismatch = self.inferred_inputs.par_iter().find_map_any(
118+
|(input_relative_path, path_fingerprint)| {
121119
let input_full_path = Arc::<AbsolutePath>::from(base_dir.join(input_relative_path));
122120
let path_read = PathRead {
123121
read_dir_entries: matches!(path_fingerprint, PathFingerprint::Folder(Some(_))),
@@ -133,7 +131,8 @@ impl PostRunFingerprint {
133131
path: input_relative_path.clone(),
134132
}))
135133
}
136-
});
134+
},
135+
);
137136
input_mismatch.transpose()
138137
}
139138
}

crates/vite_task/src/session/execute/mod.rs

Lines changed: 46 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ use vite_task_plan::{
1212
SpawnExecution,
1313
};
1414

15-
use self::glob_inputs::compute_globbed_inputs;
16-
1715
use self::{
1816
fingerprint::PostRunFingerprint,
19-
spawn::{SpawnResult, spawn_with_tracking},
17+
glob_inputs::compute_globbed_inputs,
18+
spawn::{SpawnResult, TrackedPathAccesses, spawn_with_tracking},
2019
};
2120
use super::{
2221
cache::{CommandCacheValue, ExecutionCache},
@@ -30,7 +29,6 @@ use super::{
3029
},
3130
};
3231
use crate::Session;
33-
use self::spawn::TrackedPathAccesses;
3432

3533
/// Outcome of a spawned execution.
3634
///
@@ -353,55 +351,54 @@ pub async fn execute_spawn(
353351

354352
// 6. Update cache if successful and determine cache update status.
355353
// Errors during cache update are terminal (reported through finish).
356-
let (cache_update_status, cache_error) =
357-
if let Some((cache_metadata, globbed_inputs)) = cache_metadata_and_inputs {
358-
if result.exit_status.success() {
359-
// path_reads is empty when inference is disabled (path_accesses is None)
360-
let empty_path_reads = Default::default();
361-
let path_reads = path_accesses
362-
.as_ref()
363-
.map(|pa| &pa.path_reads)
364-
.unwrap_or(&empty_path_reads);
365-
366-
// Execution succeeded — attempt to create fingerprint and update cache
367-
match PostRunFingerprint::create(
368-
path_reads,
369-
cache_base_path,
370-
&cache_metadata.input_config,
371-
) {
372-
Ok(post_run_fingerprint) => {
373-
let new_cache_value = CommandCacheValue {
374-
post_run_fingerprint,
375-
std_outputs: std_outputs.unwrap_or_default().into(),
376-
duration: result.duration,
377-
};
378-
match cache
379-
.update(cache_metadata, globbed_inputs, cache_base_path, new_cache_value)
380-
.await
381-
{
382-
Ok(()) => (CacheUpdateStatus::Updated, None),
383-
Err(err) => (
384-
CacheUpdateStatus::NotUpdated(CacheNotUpdatedReason::CacheDisabled),
385-
Some(ExecutionError::Cache {
386-
kind: CacheErrorKind::Update,
387-
source: err,
388-
}),
389-
),
390-
}
354+
let (cache_update_status, cache_error) = if let Some((cache_metadata, globbed_inputs)) =
355+
cache_metadata_and_inputs
356+
{
357+
if result.exit_status.success() {
358+
// path_reads is empty when inference is disabled (path_accesses is None)
359+
let empty_path_reads = Default::default();
360+
let path_reads =
361+
path_accesses.as_ref().map(|pa| &pa.path_reads).unwrap_or(&empty_path_reads);
362+
363+
// Execution succeeded — attempt to create fingerprint and update cache
364+
match PostRunFingerprint::create(
365+
path_reads,
366+
cache_base_path,
367+
&cache_metadata.input_config,
368+
) {
369+
Ok(post_run_fingerprint) => {
370+
let new_cache_value = CommandCacheValue {
371+
post_run_fingerprint,
372+
std_outputs: std_outputs.unwrap_or_default().into(),
373+
duration: result.duration,
374+
};
375+
match cache
376+
.update(cache_metadata, globbed_inputs, cache_base_path, new_cache_value)
377+
.await
378+
{
379+
Ok(()) => (CacheUpdateStatus::Updated, None),
380+
Err(err) => (
381+
CacheUpdateStatus::NotUpdated(CacheNotUpdatedReason::CacheDisabled),
382+
Some(ExecutionError::Cache {
383+
kind: CacheErrorKind::Update,
384+
source: err,
385+
}),
386+
),
391387
}
392-
Err(err) => (
393-
CacheUpdateStatus::NotUpdated(CacheNotUpdatedReason::CacheDisabled),
394-
Some(ExecutionError::PostRunFingerprint(err)),
395-
),
396388
}
397-
} else {
398-
// Execution failed with non-zero exit status — don't update cache
399-
(CacheUpdateStatus::NotUpdated(CacheNotUpdatedReason::NonZeroExitStatus), None)
389+
Err(err) => (
390+
CacheUpdateStatus::NotUpdated(CacheNotUpdatedReason::CacheDisabled),
391+
Some(ExecutionError::PostRunFingerprint(err)),
392+
),
400393
}
401394
} else {
402-
// Caching was disabled for this task
403-
(CacheUpdateStatus::NotUpdated(CacheNotUpdatedReason::CacheDisabled), None)
404-
};
395+
// Execution failed with non-zero exit status — don't update cache
396+
(CacheUpdateStatus::NotUpdated(CacheNotUpdatedReason::NonZeroExitStatus), None)
397+
}
398+
} else {
399+
// Caching was disabled for this task
400+
(CacheUpdateStatus::NotUpdated(CacheNotUpdatedReason::CacheDisabled), None)
401+
};
405402

406403
// 7. Finish the leaf execution with the result and optional cache error.
407404
// Cache update/fingerprint failures are reported but do not affect the outcome —

crates/vite_task_bin/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ impl vite_task::CommandHandler for CommandHandler {
126126
program: find_executable(get_path_env(&envs), &command.cwd, "print-env")?,
127127
args: [name.clone()].into(),
128128
cache_config: UserCacheConfig::with_config({
129-
EnabledCacheConfig { envs: None, pass_through_envs: Some(vec![name]), inputs: None }
129+
EnabledCacheConfig {
130+
envs: None,
131+
pass_through_envs: Some(vec![name]),
132+
inputs: None,
133+
}
130134
}),
131135
envs: Arc::new(envs),
132136
}))

0 commit comments

Comments
 (0)