Add comment explaining intentional code duplication in proc macro

Co-authored-by: enaut <290005+enaut@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-01 20:44:27 +00:00
parent cbe249b9b7
commit 9568bc10d9

View File

@ -118,6 +118,11 @@ pub fn turtle_main(args: TokenStream, input: TokenStream) -> TokenStream {
// Check if the function has the expected signature // Check if the function has the expected signature
let has_turtle_param = input_fn.sig.inputs.len() == 1; let has_turtle_param = input_fn.sig.inputs.len() == 1;
// Note: The following code has some duplication between the two branches
// (with/without turtle parameter). This is intentional in proc macros as
// we're generating different code paths, and extracting the common parts
// into helper functions would make the macro more complex without significant benefit.
let expanded = if has_turtle_param { let expanded = if has_turtle_param {
// Function takes a turtle parameter // Function takes a turtle parameter
quote! { quote! {