Skip to content

Commit 642c1ae

Browse files
committed
improve readablility
1 parent 4453659 commit 642c1ae

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

  • turbopack/crates/turbo-tasks-backend/src/backend

turbopack/crates/turbo-tasks-backend/src/backend/mod.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2581,27 +2581,20 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
25812581
// Note: We do not mark the tasks as dirty here, as these tasks are unused or stale
25822582
// anyway and we want to avoid needless re-executions. When the cells become
25832583
// used again, they are invalidated from the update cell operation.
2584+
let is_cell_unused = |cell: CellId| {
2585+
cell_counters
2586+
.get(&cell.type_id)
2587+
.is_none_or(|start_index| cell.index >= *start_index)
2588+
};
25842589
if task_id.is_transient()
2585-
|| iter_many!(task, CellData { cell }
2586-
if cell_counters
2587-
.get(&cell.type_id)
2588-
.is_none_or(|start_index| cell.index >= *start_index)
2589-
=> cell)
2590-
.count()
2591-
> 0
2590+
|| iter_many!(task, CellData { cell } => cell).any(is_cell_unused)
25922591
{
25932592
removed_data.extend(task.extract_if(CachedDataItemType::CellData, |key, _| {
25942593
matches!(key, CachedDataItemKey::CellData { cell } if cell_counters.get(&cell.type_id).is_none_or(|start_index| cell.index >= *start_index))
25952594
}));
25962595
}
25972596
if task_id.is_transient()
2598-
|| iter_many!(task, TransientCellData { cell }
2599-
if cell_counters
2600-
.get(&cell.type_id)
2601-
.is_none_or(|start_index| cell.index >= *start_index)
2602-
=> cell)
2603-
.count()
2604-
> 0
2597+
|| iter_many!(task, TransientCellData { cell } => cell).any(is_cell_unused)
26052598
{
26062599
removed_data.extend(task.extract_if(
26072600
CachedDataItemType::TransientCellData,

0 commit comments

Comments
 (0)