aboutsummaryrefslogtreecommitdiff
path: root/mingling_macros/src/structural_data.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-10 00:59:27 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-10 01:08:49 +0800
commite260a5e4cc1ea727fa32aa6e61c0e0f4e9a89f9c (patch)
treed90d43832af89e51cc2c75e210fb124ac906206b /mingling_macros/src/structural_data.rs
parent38578615e13ac6f131715880706fefed2e4ea3d4 (diff)
feat(structural_data): align type use generation with group_impl
Diffstat (limited to 'mingling_macros/src/structural_data.rs')
-rw-r--r--mingling_macros/src/structural_data.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/mingling_macros/src/structural_data.rs b/mingling_macros/src/structural_data.rs
index d556d8c..5350d7e 100644
--- a/mingling_macros/src/structural_data.rs
+++ b/mingling_macros/src/structural_data.rs
@@ -268,11 +268,18 @@ pub(crate) fn group_structural(input: TokenStream) -> TokenStream {
proc_macro2::Span::call_site(),
);
- // Generate the appropriate `use` statement
+ // Generate the appropriate `use` statement for the original type
+ // (consistent with gen_type_use in group_impl.rs)
let type_use = if type_path.path.segments.len() > 1 {
quote! { #[allow(unused_imports)] use #type_path; }
} else {
- let ident = &type_name;
+ let ident = type_path
+ .path
+ .segments
+ .last()
+ .expect("TypePath must have at least one segment")
+ .ident
+ .clone();
quote! { #[allow(unused_imports)] use super::#ident; }
};