Skip to content

Commit 6daa8fa

Browse files
branchseerclaude
andcommitted
refactor(cache): rename FingerprintMismatch variants and fix lint warnings
Drop redundant suffixes from FingerprintMismatch variants (e.g. SpawnFingerprintMismatch → SpawnFingerprint) to fix enum_variant_names lint. Also fix if_not_else and doc_markdown warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0ec94fa commit 6daa8fa

3 files changed

Lines changed: 27 additions & 27 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub fn format_cache_status_inline(cache_status: &CacheStatus) -> Option<Str> {
155155
CacheStatus::Miss(CacheMiss::FingerprintMismatch(mismatch)) => {
156156
// Show "cache miss" with reason why cache couldn't be used
157157
let reason = match mismatch {
158-
FingerprintMismatch::SpawnFingerprintMismatch { old, new } => {
158+
FingerprintMismatch::SpawnFingerprint { old, new } => {
159159
let changes = detect_spawn_fingerprint_changes(old, new);
160160
match changes.first() {
161161
Some(
@@ -173,13 +173,13 @@ pub fn format_cache_status_inline(cache_status: &CacheStatus) -> Option<Str> {
173173
None => "configuration changed",
174174
}
175175
}
176-
FingerprintMismatch::InputConfigChanged => "inputs configuration changed",
177-
FingerprintMismatch::GlobbedInputChanged { path } => {
176+
FingerprintMismatch::InputConfig => "inputs configuration changed",
177+
FingerprintMismatch::GlobbedInput { path } => {
178178
return Some(vite_str::format!(
179179
"✗ cache miss: content of input '{path}' changed, executing"
180180
));
181181
}
182-
FingerprintMismatch::PostRunFingerprintMismatch(diff) => {
182+
FingerprintMismatch::PostRunFingerprint(diff) => {
183183
use crate::session::execute::fingerprint::PostRunFingerprintMismatch;
184184
match diff {
185185
PostRunFingerprintMismatch::InputContentChanged { path } => {

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,33 +101,33 @@ pub enum CacheMiss {
101101
pub enum FingerprintMismatch {
102102
/// Found a previous cache entry key for the same task, but the spawn fingerprint differs.
103103
/// This happens when the command itself or an env changes.
104-
SpawnFingerprintMismatch {
104+
SpawnFingerprint {
105105
/// The fingerprint from the cached entry
106106
old: SpawnFingerprint,
107107
/// The fingerprint of the current execution
108108
new: SpawnFingerprint,
109109
},
110110
/// Found a previous cache entry key for the same task, but `input_config` or `glob_base` differs.
111-
InputConfigChanged,
111+
InputConfig,
112112
/// Found the cache entry with the same spawn fingerprint, but an explicit globbed input changed
113-
GlobbedInputChanged { path: RelativePathBuf },
113+
GlobbedInput { path: RelativePathBuf },
114114
/// Found the cache entry with the same spawn fingerprint, but the post-run fingerprint mismatches
115-
PostRunFingerprintMismatch(PostRunFingerprintMismatch),
115+
PostRunFingerprint(PostRunFingerprintMismatch),
116116
}
117117

118118
impl Display for FingerprintMismatch {
119119
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
120120
match self {
121-
Self::SpawnFingerprintMismatch { old, new } => {
121+
Self::SpawnFingerprint { old, new } => {
122122
write!(f, "Spawn fingerprint changed: old={old:?}, new={new:?}")
123123
}
124-
Self::InputConfigChanged => {
124+
Self::InputConfig => {
125125
write!(f, "inputs configuration changed")
126126
}
127-
Self::GlobbedInputChanged { path } => {
127+
Self::GlobbedInput { path } => {
128128
write!(f, "content of input '{path}' changed")
129129
}
130-
Self::PostRunFingerprintMismatch(diff) => Display::fmt(diff, f),
130+
Self::PostRunFingerprint(diff) => Display::fmt(diff, f),
131131
}
132132
}
133133
}
@@ -222,7 +222,7 @@ impl ExecutionCache {
222222
cache_value.post_run_fingerprint.validate(workspace_root)?
223223
{
224224
return Ok(Err(CacheMiss::FingerprintMismatch(
225-
FingerprintMismatch::PostRunFingerprintMismatch(post_run_fingerprint_mismatch),
225+
FingerprintMismatch::PostRunFingerprint(post_run_fingerprint_mismatch),
226226
)));
227227
}
228228
// Associate the execution key to the cache entry key if not already,
@@ -237,14 +237,14 @@ impl ExecutionCache {
237237
self.get_cache_key_by_execution_key(execution_cache_key).await?
238238
{
239239
// Determine what changed: spawn fingerprint or config (input_config / glob_base)
240-
let mismatch = if old_cache_key.spawn_fingerprint != *spawn_fingerprint {
241-
FingerprintMismatch::SpawnFingerprintMismatch {
240+
let mismatch = if old_cache_key.spawn_fingerprint == *spawn_fingerprint {
241+
// spawn fingerprint is the same but input_config or glob_base changed
242+
FingerprintMismatch::InputConfig
243+
} else {
244+
FingerprintMismatch::SpawnFingerprint {
242245
old: old_cache_key.spawn_fingerprint,
243246
new: spawn_fingerprint.clone(),
244247
}
245-
} else {
246-
// spawn fingerprint is the same but input_config or glob_base changed
247-
FingerprintMismatch::InputConfigChanged
248248
};
249249
return Ok(Err(CacheMiss::FingerprintMismatch(mismatch)));
250250
}
@@ -291,21 +291,21 @@ fn detect_globbed_input_change(
291291
match (s, c) {
292292
(None, None) => return None,
293293
(Some((path, _)), None) | (None, Some((path, _))) => {
294-
return Some(FingerprintMismatch::GlobbedInputChanged { path: path.clone() });
294+
return Some(FingerprintMismatch::GlobbedInput { path: path.clone() });
295295
}
296296
(Some((sp, sh)), Some((cp, ch))) => match sp.cmp(cp) {
297297
std::cmp::Ordering::Equal => {
298298
if sh != ch {
299-
return Some(FingerprintMismatch::GlobbedInputChanged { path: sp.clone() });
299+
return Some(FingerprintMismatch::GlobbedInput { path: sp.clone() });
300300
}
301301
s = stored_iter.next();
302302
c = current_iter.next();
303303
}
304304
std::cmp::Ordering::Less => {
305-
return Some(FingerprintMismatch::GlobbedInputChanged { path: sp.clone() });
305+
return Some(FingerprintMismatch::GlobbedInput { path: sp.clone() });
306306
}
307307
std::cmp::Ordering::Greater => {
308-
return Some(FingerprintMismatch::GlobbedInputChanged { path: cp.clone() });
308+
return Some(FingerprintMismatch::GlobbedInput { path: cp.clone() });
309309
}
310310
},
311311
}

crates/vite_task/src/session/reporter/summary.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub enum SavedCacheMissReason {
112112
NotFound,
113113
/// Spawn fingerprint changed (command, envs, cwd, etc.).
114114
SpawnFingerprintChanged(Vec<SpawnFingerprintChange>),
115-
/// Task configuration changed (input_config or glob_base).
115+
/// Task configuration changed (`input_config` or `glob_base`).
116116
ConfigChanged,
117117
/// Content of an input file changed.
118118
InputContentChanged { path: Str },
@@ -237,14 +237,14 @@ impl SavedCacheMissReason {
237237
match cache_miss {
238238
CacheMiss::NotFound => Self::NotFound,
239239
CacheMiss::FingerprintMismatch(mismatch) => match mismatch {
240-
FingerprintMismatch::SpawnFingerprintMismatch { old, new } => {
240+
FingerprintMismatch::SpawnFingerprint { old, new } => {
241241
Self::SpawnFingerprintChanged(detect_spawn_fingerprint_changes(old, new))
242242
}
243-
FingerprintMismatch::InputConfigChanged => Self::ConfigChanged,
244-
FingerprintMismatch::GlobbedInputChanged { path } => {
243+
FingerprintMismatch::InputConfig => Self::ConfigChanged,
244+
FingerprintMismatch::GlobbedInput { path } => {
245245
Self::InputContentChanged { path: Str::from(path.as_str()) }
246246
}
247-
FingerprintMismatch::PostRunFingerprintMismatch(diff) => {
247+
FingerprintMismatch::PostRunFingerprint(diff) => {
248248
use crate::session::execute::fingerprint::PostRunFingerprintMismatch;
249249
match diff {
250250
PostRunFingerprintMismatch::InputContentChanged { path } => {

0 commit comments

Comments
 (0)