From d463bde66edaa7d4e41bf55b3b9812b5130f5423 Mon Sep 17 00:00:00 2001 From: Benjamin Woodruff Date: Fri, 6 Sep 2024 08:48:56 -0700 Subject: [PATCH] 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. --- .../src/references/mod.rs | 30 ++----------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs index 665cf4ef69b2f..871c7229197fa 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs @@ -18,9 +18,7 @@ pub mod util; use std::{ borrow::Cow, collections::{BTreeMap, HashMap, HashSet}, - future::Future, mem::take, - pin::Pin, sync::Arc, }; @@ -1243,30 +1241,6 @@ pub(crate) async fn analyse_ecmascript_module_internal( .await } -fn handle_call_boxed<'a, G: Fn(Vec) + Send + Sync + 'a>( - ast_path: &'a [AstParentKind], - span: Span, - func: JsValue, - this: JsValue, - args: Vec, - state: &'a AnalysisState<'a>, - add_effects: &'a G, - analysis: &'a mut AnalyzeEcmascriptModuleResultBuilder, - in_try: bool, -) -> Pin> + Send + 'a>> { - Box::pin(handle_call( - ast_path, - span, - func, - this, - args, - state, - add_effects, - analysis, - in_try, - )) -} - async fn handle_call) + Send + Sync>( ast_path: &[AstParentKind], span: Span, @@ -1317,7 +1291,7 @@ async fn handle_call) + Send + Sync>( logical_property: _, } => { for alt in values { - handle_call_boxed( + Box::pin(handle_call( ast_path, span, alt, @@ -1327,7 +1301,7 @@ async fn handle_call) + Send + Sync>( add_effects, analysis, in_try, - ) + )) .await?; } }