From 9568bc10d93ed9bf27800646037bd6dfbf1d0cd3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 1 Jan 2026 20:44:27 +0000 Subject: [PATCH] Add comment explaining intentional code duplication in proc macro Co-authored-by: enaut <290005+enaut@users.noreply.github.com> --- turtle-lib-macros/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/turtle-lib-macros/src/lib.rs b/turtle-lib-macros/src/lib.rs index 5ed3835..ce33586 100644 --- a/turtle-lib-macros/src/lib.rs +++ b/turtle-lib-macros/src/lib.rs @@ -118,6 +118,11 @@ pub fn turtle_main(args: TokenStream, input: TokenStream) -> TokenStream { // Check if the function has the expected signature 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 { // Function takes a turtle parameter quote! {