From c48149a86eafcca967ef9aa947864fb4d0c727ea Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 16 May 2026 22:08:39 +0800 Subject: Replace hardcoded `ThisProgram` ident with shared constant --- mingling_macros/src/groupped.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mingling_macros/src/groupped.rs') diff --git a/mingling_macros/src/groupped.rs b/mingling_macros/src/groupped.rs index 3c30827..4fd0665 100644 --- a/mingling_macros/src/groupped.rs +++ b/mingling_macros/src/groupped.rs @@ -3,6 +3,8 @@ use proc_macro2::Span; use quote::quote; use syn::{Attribute, DeriveInput, Ident, parse_macro_input}; +use crate::DEFAULT_PROGRAM_NAME; + /// Parses the `#[group(...)]` attribute to extract the group type fn parse_group_attribute(attrs: &[Attribute]) -> Option { for attr in attrs { @@ -24,7 +26,7 @@ pub fn derive_groupped(input: TokenStream) -> TokenStream { // Parse attributes to find #[group(...)] let group_ident = parse_group_attribute(&input.attrs) - .unwrap_or_else(|| Ident::new("ThisProgram", Span::call_site())); + .unwrap_or_else(|| Ident::new(DEFAULT_PROGRAM_NAME, Span::call_site())); let any_output_convert_impls = proc_macro2::TokenStream::from(build_any_output_convert_impls( struct_name.clone(), @@ -55,7 +57,7 @@ pub fn derive_groupped_serialize(input: TokenStream) -> TokenStream { // Parse attributes to find #[group(...)] let group_ident = parse_group_attribute(&input_parsed.attrs) - .unwrap_or_else(|| Ident::new("ThisProgram", Span::call_site())); + .unwrap_or_else(|| Ident::new(DEFAULT_PROGRAM_NAME, Span::call_site())); let any_output_convert_impls = proc_macro2::TokenStream::from(build_any_output_convert_impls( struct_name.clone(), -- cgit