Skip to content

Commit

Permalink
refactor(turbo-tasks-memory): Minor cleanup of code in turbo-tasks-me…
Browse files Browse the repository at this point in the history
…mory/src/task.rs
  • Loading branch information
bgw committed Aug 30, 2024
1 parent 7ce8ac4 commit 9e272d6
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions turbopack/crates/turbo-tasks-memory/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,33 +744,31 @@ 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);
drop(entered);
(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)
Expand All @@ -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)
Expand Down

0 comments on commit 9e272d6

Please sign in to comment.