Unverified Commit d463bde6 authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

chore(turbopack-ecmascript): Remove unneeded async recursion '_boxed' 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.
parent faef2f1e
...@@ -18,9 +18,7 @@ pub mod util; ...@@ -18,9 +18,7 @@ pub mod util;
use std::{ use std::{
borrow::Cow, borrow::Cow,
collections::{BTreeMap, HashMap, HashSet}, collections::{BTreeMap, HashMap, HashSet},
future::Future,
mem::take, mem::take,
pin::Pin,
sync::Arc, sync::Arc,
}; };
...@@ -1243,30 +1241,6 @@ pub(crate) async fn analyse_ecmascript_module_internal( ...@@ -1243,30 +1241,6 @@ pub(crate) async fn analyse_ecmascript_module_internal(
.await .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>( async fn handle_call<G: Fn(Vec<Effect>) + Send + Sync>(
ast_path: &[AstParentKind], ast_path: &[AstParentKind],
span: Span, span: Span,
...@@ -1317,7 +1291,7 @@ async fn handle_call<G: Fn(Vec<Effect>) + Send + Sync>( ...@@ -1317,7 +1291,7 @@ async fn handle_call<G: Fn(Vec<Effect>) + Send + Sync>(
logical_property: _, logical_property: _,
} => { } => {
for alt in values { for alt in values {
handle_call_boxed( Box::pin(handle_call(
ast_path, ast_path,
span, span,
alt, alt,
...@@ -1327,7 +1301,7 @@ async fn handle_call<G: Fn(Vec<Effect>) + Send + Sync>( ...@@ -1327,7 +1301,7 @@ async fn handle_call<G: Fn(Vec<Effect>) + Send + Sync>(
add_effects, add_effects,
analysis, analysis,
in_try, in_try,
) ))
.await?; .await?;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment