From 9e272d6010b8742899de0d20ef2193380c89bb7b Mon Sep 17 00:00:00 2001 From: Benjamin Woodruff Date: Fri, 30 Aug 2024 10:57:52 -0700 Subject: [PATCH] refactor(turbo-tasks-memory): Minor cleanup of code in turbo-tasks-memory/src/task.rs --- .../crates/turbo-tasks-memory/src/task.rs | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/turbopack/crates/turbo-tasks-memory/src/task.rs b/turbopack/crates/turbo-tasks-memory/src/task.rs index aacb6f138f66e..cf1a9bffe7f81 100644 --- a/turbopack/crates/turbo-tasks-memory/src/task.rs +++ b/turbopack/crates/turbo-tasks-memory/src/task.rs @@ -744,11 +744,11 @@ impl Task { ), TaskType::Persistent { ty, .. } | TaskType::Transient { ty, .. } => match &***ty { CachedTaskType::Native { - fn_type: native_fn, + fn_type: native_fn_id, this, arg, } => { - let func = registry::get_function(*native_fn); + let func = registry::get_function(*native_fn_id); let span = func.span(); let entered = span.enter(); let future = func.execute(*this, &**arg); @@ -756,21 +756,19 @@ impl Task { (future, span) } CachedTaskType::ResolveNative { - fn_type: ref native_fn_id, + fn_type: native_fn_id, this, arg, } => { - let native_fn_id = *native_fn_id; - let func = registry::get_function(native_fn_id); + let func = registry::get_function(*native_fn_id); let span = func.resolve_span(); let entered = span.enter(); - let turbo_tasks = turbo_tasks.pin(); let future = Box::pin(CachedTaskType::run_resolve_native( - native_fn_id, + *native_fn_id, *this, &**arg, self.id.persistence(), - turbo_tasks, + turbo_tasks.pin(), )); drop(entered); (future, span) @@ -781,19 +779,16 @@ impl Task { this, arg, } => { - let trait_type_id = *trait_type_id; - let trait_type = registry::get_trait(trait_type_id); + let trait_type = registry::get_trait(*trait_type_id); let span = trait_type.resolve_span(name); let entered = span.enter(); - let name = name.clone(); - let turbo_tasks = turbo_tasks.pin(); let future = Box::pin(CachedTaskType::run_resolve_trait( - trait_type_id, - name, + *trait_type_id, + name.clone(), *this, &**arg, self.id.persistence(), - turbo_tasks, + turbo_tasks.pin(), )); drop(entered); (future, span)