diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-10 16:19:45 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-10 16:19:45 +0800 |
| commit | 2d0aae4b2d595ced100f7a2ec8d13b872a5eb65e (patch) | |
| tree | 9df306e1185470655f3ed43fad866cf02430160f /mingling_macros/src/func/pack_err_structural.rs | |
| parent | 61b770ca958afa7e5eca4c50f5e06bdf3ed7a94a (diff) | |
refactor: simplify macro parsing code and fix clippy warnings
Diffstat (limited to 'mingling_macros/src/func/pack_err_structural.rs')
| -rw-r--r-- | mingling_macros/src/func/pack_err_structural.rs | 9 |
1 files changed, 5 insertions, 4 deletions
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::<Token![=]>()?; 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 }) } } } |
