Skip to content

Commit 379efcd

Browse files
authored
refactor: remove dead Option and is_cache_hit from labeled reporter (#163)
## Summary Follow-up to #162 — remove vestiges left by that refactor: - **`summary_buf`**: was unconditionally `Some(...)` after the `is_single_displayless` condition was removed. Unwrap the `Option` and write the buffer directly. - **`is_cache_hit`** field on `LabeledLeafReporter`: set in `start()` but never read — its only consumer was the `self.display.is_none() && self.is_cache_hit` block removed in #162. Remove the field, its initialization, and its assignment.
1 parent b4dba39 commit 379efcd

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ impl GraphExecutionReporter for LabeledGraphReporter {
151151
display,
152152
workspace_path: Arc::clone(&self.workspace_path),
153153
started: false,
154-
is_cache_hit: false,
155154
})
156155
}
157156

@@ -162,7 +161,7 @@ impl GraphExecutionReporter for LabeledGraphReporter {
162161
let shared = self.shared.borrow();
163162

164163
let summary_buf =
165-
Some(format_summary(&shared.executions, &shared.stats, &self.workspace_path));
164+
format_summary(&shared.executions, &shared.stats, &self.workspace_path);
166165

167166
// Determine exit code based on failed tasks and infrastructure errors:
168167
// - Infrastructure errors (cache lookup, spawn failure) have error_message set
@@ -201,10 +200,10 @@ impl GraphExecutionReporter for LabeledGraphReporter {
201200
};
202201
// shared borrow dropped here
203202

204-
// Write the summary buffer asynchronously (if any)
205-
if let Some(buf) = summary_buf {
203+
// Write the summary buffer asynchronously
204+
{
206205
let mut writer = self.writer.borrow_mut();
207-
let _ = writer.write_all(&buf).await;
206+
let _ = writer.write_all(&summary_buf).await;
208207
let _ = writer.flush().await;
209208
}
210209

@@ -225,8 +224,6 @@ struct LabeledLeafReporter {
225224
/// Whether `start()` has been called. Used to determine if stats should be updated
226225
/// in `finish()` and whether to push an `ExecutionInfo` entry.
227226
started: bool,
228-
/// Whether the current execution is a cache hit, set by `start()`.
229-
is_cache_hit: bool,
230227
}
231228

232229
#[async_trait::async_trait(?Send)]
@@ -238,7 +235,6 @@ struct LabeledLeafReporter {
238235
impl LeafExecutionReporter for LabeledLeafReporter {
239236
async fn start(&mut self, cache_status: CacheStatus) -> StdioConfig {
240237
self.started = true;
241-
self.is_cache_hit = matches!(cache_status, CacheStatus::Hit { .. });
242238

243239
// Update shared state synchronously, then drop the borrow before any async writes.
244240
let suggestion = {

0 commit comments

Comments
 (0)