From 2d0aae4b2d595ced100f7a2ec8d13b872a5eb65e Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 10 Aug 2026 16:19:45 +0800 Subject: refactor: simplify macro parsing code and fix clippy warnings --- mingling_macros/src/func/pack_err_structural.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'mingling_macros/src/func/pack_err_structural.rs') diff --git a/mingling_macros/src/func/pack_err_structural.rs b/mingling_macros/src/func/pack_err_structural.rs index 7d3a6f8..2c4a2fb 100644 --- a/mingling_macros/src/func/pack_err_structural.rs +++ b/mingling_macros/src/func/pack_err_structural.rs @@ -9,8 +9,9 @@ pub(crate) fn pack_err_structural(input: TokenStream) -> TokenStream { let parsed = parse_macro_input!(input as PackErrInput); let type_name = match &parsed { - PackErrInput::Simple { type_name } => type_name.clone(), - PackErrInput::Typed { type_name, .. } => type_name.clone(), + PackErrInput::Simple { type_name } | PackErrInput::Typed { type_name, .. } => { + type_name.clone() + } }; // Register in STRUCTURED_TYPES @@ -108,12 +109,12 @@ impl syn::parse::Parse for PackErrInput { if input.peek(Token![=]) { input.parse::()?; let inner_type: Type = input.parse()?; - Ok(PackErrInput::Typed { + Ok(Self::Typed { type_name, inner_type: Box::new(inner_type), }) } else { - Ok(PackErrInput::Simple { type_name }) + Ok(Self::Simple { type_name }) } } } -- cgit