From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 2EB161FF0E2 for ; Thu, 30 Jul 2026 12:23:46 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id E7AD621419; Thu, 30 Jul 2026 12:23:45 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: Re: [PATCH perlmod v2 4/5] macro: function: move signature inputs handling into helper struct From: Wolfgang Bumiller To: "Max R. Carrara" In-Reply-To: <20260724144914.658730-5-m.carrara@proxmox.com> References: <20260724144914.658730-1-m.carrara@proxmox.com> <20260724144914.658730-5-m.carrara@proxmox.com> Date: Thu, 30 Jul 2026 12:23:39 +0200 Message-Id: <178540701947.33538.12090262967135005646.b4-review@b4> X-Mailer: b4 0.15.2 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1785407012542 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.188 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: WSADPJATGD36YYS2FIRJL6N64C4LRLOP X-Message-ID-Hash: WSADPJATGD36YYS2FIRJL6N64C4LRLOP X-MailFrom: w.bumiller@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri, 24 Jul 2026 16:49:06 +0200, Max R. Carrara wrote: > diff --git a/perlmod-macro/src/function.rs b/perlmod-macro/src/function.rs > index 3ca7bd0..f5415c5 100644 > --- a/perlmod-macro/src/function.rs > +++ b/perlmod-macro/src/function.rs > @@ -210,6 +210,171 @@ fn deserialized_argument_code( > [ ... skip 44 lines ... ] > + let arg_attr = ArgumentAttr::new_from_fn_arg(arg)?; > + > + let arg_type: &syn::Type = arg_attr.pat_type.ty.as_ref(); > + > + let arg_name = { > + let pattern: &syn::Pat = arg_attr.pat_type.pat.as_ref(); This binding is unnecessary - let's drop the enclosing block and indentation and match directly… > + match pattern { > + syn::Pat::Ident(ident) => { > + if ident.by_ref.is_some() { > + bail!(ident => "xsub does not support by-ref parameters"); > + } > + if ident.subpat.is_some() { > + bail!(ident => "xsub does not support sub-patterns on parameters"); > + } > + &ident.ident > + } > + _ => bail!(pattern => "xsub does not support this kind of parameter"), … ↑ with `s/_/pattern/` here. > @@ -451,36 +527,48 @@ pub fn handle_function( > [ ... skip 30 lines ... ] > - proto.push(';'); > - for _ in 0..trailing_options { > - proto.push('$'); > + > + match (trailing_options, trailing_type) { > + (1.., ty) => { Not too happy about this - the `if` previously was sufficient, and the `match` now doesn't do any matching on `trailing_type` - it just rebinds it to `ty`, so just more indentation for no gain? --