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.rs | |
| parent | 61b770ca958afa7e5eca4c50f5e06bdf3ed7a94a (diff) | |
refactor: simplify macro parsing code and fix clippy warnings
Diffstat (limited to 'mingling_macros/src/func/pack_err.rs')
| -rw-r--r-- | mingling_macros/src/func/pack_err.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mingling_macros/src/func/pack_err.rs b/mingling_macros/src/func/pack_err.rs index 8b224b0..dcfcf86 100644 --- a/mingling_macros/src/func/pack_err.rs +++ b/mingling_macros/src/func/pack_err.rs @@ -4,9 +4,9 @@ use quote::quote; use syn::{Ident, Token, Type, parse_macro_input}; enum PackErrInput { - /// pack_err!(ErrorNotFound) + /// `pack_err!(ErrorNotFound)` Simple { type_name: Ident }, - /// pack_err!(ErrorNotDir = PathBuf) + /// `pack_err!(ErrorNotDir = PathBuf)` Typed { type_name: Ident, inner_type: Box<Type>, @@ -20,12 +20,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 }) } } } |
