Skip to content

Commit

Permalink
chore(turbopack-ecmascript): Remove unneeded async recursion '_boxed'…
Browse files Browse the repository at this point in the history
… helper (#69762)

Noticed while reading through this code. [As of Rust 1.77.0, recursive async functions are allowed inline, as long as they use indirection](https://blog.rust-lang.org/2024/03/21/Rust-1.77.0.html#support-for-recursion-in-async-fn).

This cleans up the helper method.
  • Loading branch information
bgw authored Sep 6, 2024
1 parent faef2f1 commit d463bde
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions turbopack/crates/turbopack-ecmascript/src/references/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ pub mod util;
use std::{
borrow::Cow,
collections::{BTreeMap, HashMap, HashSet},
future::Future,
mem::take,
pin::Pin,
sync::Arc,
};

Expand Down Expand Up @@ -1243,30 +1241,6 @@ pub(crate) async fn analyse_ecmascript_module_internal(
.await
}

fn handle_call_boxed<'a, G: Fn(Vec<Effect>) + Send + Sync + 'a>(
ast_path: &'a [AstParentKind],
span: Span,
func: JsValue,
this: JsValue,
args: Vec<EffectArg>,
state: &'a AnalysisState<'a>,
add_effects: &'a G,
analysis: &'a mut AnalyzeEcmascriptModuleResultBuilder,
in_try: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>> {
Box::pin(handle_call(
ast_path,
span,
func,
this,
args,
state,
add_effects,
analysis,
in_try,
))
}

async fn handle_call<G: Fn(Vec<Effect>) + Send + Sync>(
ast_path: &[AstParentKind],
span: Span,
Expand Down Expand Up @@ -1317,7 +1291,7 @@ async fn handle_call<G: Fn(Vec<Effect>) + Send + Sync>(
logical_property: _,
} => {
for alt in values {
handle_call_boxed(
Box::pin(handle_call(
ast_path,
span,
alt,
Expand All @@ -1327,7 +1301,7 @@ async fn handle_call<G: Fn(Vec<Effect>) + Send + Sync>(
add_effects,
analysis,
in_try,
)
))
.await?;
}
}
Expand Down

0 comments on commit d463bde

Please sign in to comment.