Skip to content

Commit

Permalink
Merge pull request #1618 from sdroege/callbacks-no-box-reference
Browse files Browse the repository at this point in the history
Don't cast callbacks as `&Box<T>` but use `&T` instead to make clippy…
  • Loading branch information
sdroege authored Nov 15, 2024
2 parents a491943 + 3205306 commit 63aaa63
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/codegen/function_body_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,19 @@ 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::<Vec<_>>()
.join(", ")
);
Some((s.clone(), s))
} else {
let s = format!(
"Box_<({})>",
Expand Down Expand Up @@ -482,13 +495,7 @@ impl Builder {
},
func
))),
type_: Some(Box::new(Chunk::Custom(
if !trampoline.scope.is_async() && !trampoline.scope.is_call() {
format!("&{}", full_type.1)
} else {
full_type.1.clone()
},
))),
type_: Some(Box::new(Chunk::Custom(full_type.1.clone()))),
});
if trampoline.scope.is_async() {
body.push(Chunk::Custom(format!(
Expand Down

0 comments on commit 63aaa63

Please sign in to comment.