From 044dd2c4767cef869700527d0ce3b5c8d83d2eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 15 Nov 2024 12:55:51 +0200 Subject: [PATCH 1/2] Revert "Don't cast callbacks as `&Box` but use `&T` instead to make clippy happy" This reverts commit 3205306b219e100f6a96827cd131d65da475d310. --- src/codegen/function_body_chunk.rs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/codegen/function_body_chunk.rs b/src/codegen/function_body_chunk.rs index 50c0911d5..c3e5a4194 100644 --- a/src/codegen/function_body_chunk.rs +++ b/src/codegen/function_body_chunk.rs @@ -183,19 +183,6 @@ impl Builder { .join(", ") ), )) - } else if !calls - .iter() - .any(|c| c.scope.is_async() || c.scope.is_call()) - { - let s = format!( - "&({})", - calls - .iter() - .map(|c| c.bound_name.to_string()) - .collect::>() - .join(", ") - ); - Some((s.clone(), s)) } else { let s = format!( "Box_<({})>", @@ -495,7 +482,13 @@ impl Builder { }, func ))), - type_: Some(Box::new(Chunk::Custom(full_type.1.clone()))), + type_: Some(Box::new(Chunk::Custom( + if !trampoline.scope.is_async() && !trampoline.scope.is_call() { + format!("&{}", full_type.1) + } else { + full_type.1.clone() + }, + ))), }); if trampoline.scope.is_async() { body.push(Chunk::Custom(format!( From 67781242b9104068475f16238070e0ad2b5f608e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 15 Nov 2024 12:58:33 +0200 Subject: [PATCH 2/2] Don't cast callbacks as `&Box` but use `&T` instead to make clippy happy --- src/codegen/function_body_chunk.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/codegen/function_body_chunk.rs b/src/codegen/function_body_chunk.rs index c3e5a4194..6bee059c9 100644 --- a/src/codegen/function_body_chunk.rs +++ b/src/codegen/function_body_chunk.rs @@ -484,7 +484,15 @@ impl Builder { ))), type_: Some(Box::new(Chunk::Custom( if !trampoline.scope.is_async() && !trampoline.scope.is_call() { - format!("&{}", full_type.1) + format!( + "&{}", + full_type + .1 + .strip_prefix("Box_<") + .unwrap() + .strip_suffix(">") + .unwrap() + ) } else { full_type.1.clone() },