diff --git a/crates/turbo-tasks-memory/src/memory_backend.rs b/crates/turbo-tasks-memory/src/memory_backend.rs index 95e34e0ef9fb7..abfaddea3d135 100644 --- a/crates/turbo-tasks-memory/src/memory_backend.rs +++ b/crates/turbo-tasks-memory/src/memory_backend.rs @@ -560,7 +560,7 @@ impl Backend for MemoryBackend { .first() .cloned() .expect("No arguments for trait call"); - let stats = Arc::clone(&stats); + let stats = Arc::clone(stats); turbo_tasks.run_once(Box::pin(async move { let function_id = PersistentTaskType::resolve_trait_method(trait_type, name, this) diff --git a/crates/turbo-tasks-memory/src/task_statistics.rs b/crates/turbo-tasks-memory/src/task_statistics.rs index 9914bd9de24f1..799705336e31a 100644 --- a/crates/turbo-tasks-memory/src/task_statistics.rs +++ b/crates/turbo-tasks-memory/src/task_statistics.rs @@ -11,11 +11,12 @@ pub struct TaskStatisticsApi { } impl TaskStatisticsApi { - pub fn enable(&self) { + pub fn enable(&self) -> &Arc { // ignore error: potentially already initialized, that's okay let _ = self.inner.set(Arc::new(TaskStatistics { inner: DashMap::new(), })); + self.inner.get().unwrap() } pub fn is_enabled(&self) -> bool { @@ -55,12 +56,7 @@ impl TaskStatistics { task_function_id: FunctionId, func: impl Fn(&mut TaskFunctionStatistics), ) { - func( - self.inner - .entry(task_function_id) - .or_insert(TaskFunctionStatistics::default()) - .value_mut(), - ) + func(self.inner.entry(task_function_id).or_default().value_mut()) } }