diff options
Diffstat (limited to 'mingling_macros/src/func')
| -rw-r--r-- | mingling_macros/src/func/dispatcher.rs | 2 | ||||
| -rw-r--r-- | mingling_macros/src/func/entry.rs | 4 | ||||
| -rw-r--r-- | mingling_macros/src/func/group.rs | 4 | ||||
| -rw-r--r-- | mingling_macros/src/func/group_structural.rs | 4 | ||||
| -rw-r--r-- | mingling_macros/src/func/pack_err.rs | 8 | ||||
| -rw-r--r-- | mingling_macros/src/func/pack_err_structural.rs | 9 |
6 files changed, 16 insertions, 15 deletions
diff --git a/mingling_macros/src/func/dispatcher.rs b/mingling_macros/src/func/dispatcher.rs index d834c95..bbe1074 100644 --- a/mingling_macros/src/func/dispatcher.rs +++ b/mingling_macros/src/func/dispatcher.rs @@ -32,7 +32,7 @@ impl Parse for DispatcherChainInput { if input.is_empty() { #[cfg(feature = "extras")] { - return Ok(DispatcherChainInput::Auto { + return Ok(Self::Auto { cmd_attrs, command_name, }); diff --git a/mingling_macros/src/func/entry.rs b/mingling_macros/src/func/entry.rs index 35209e5..76fbc15 100644 --- a/mingling_macros/src/func/entry.rs +++ b/mingling_macros/src/func/entry.rs @@ -18,11 +18,11 @@ impl syn::parse::Parse for EntryInput { let content; syn::bracketed!(content in input); let strings = parse_strings(&content)?; - Ok(EntryInput::Typed { ident, strings }) + Ok(Self::Typed { ident, strings }) } else { // entry!["a", "b", "c"] — bare bracket content let strings = parse_strings(input)?; - Ok(EntryInput::Untyped { strings }) + Ok(Self::Untyped { strings }) } } } diff --git a/mingling_macros/src/func/group.rs b/mingling_macros/src/func/group.rs index edb1fe1..8ca46d9 100644 --- a/mingling_macros/src/func/group.rs +++ b/mingling_macros/src/func/group.rs @@ -33,10 +33,10 @@ impl Parse for GroupInput { let alias: Ident = input.parse()?; let _eq: syn::Token![=] = input.parse()?; let type_path: TypePath = input.parse()?; - Ok(GroupInput::Aliased { alias, type_path }) + Ok(Self::Aliased { alias, type_path }) } else { let type_path: TypePath = input.parse()?; - Ok(GroupInput::Plain(type_path)) + Ok(Self::Plain(type_path)) } } } diff --git a/mingling_macros/src/func/group_structural.rs b/mingling_macros/src/func/group_structural.rs index 2bd2f83..3e6dbc5 100644 --- a/mingling_macros/src/func/group_structural.rs +++ b/mingling_macros/src/func/group_structural.rs @@ -115,10 +115,10 @@ impl syn::parse::Parse for GroupStructuralInput { let alias: Ident = input.parse()?; let _eq: syn::Token![=] = input.parse()?; let type_path: TypePath = input.parse()?; - Ok(GroupStructuralInput::Aliased { alias, type_path }) + Ok(Self::Aliased { alias, type_path }) } else { let type_path: TypePath = input.parse()?; - Ok(GroupStructuralInput::Plain(type_path)) + Ok(Self::Plain(type_path)) } } } 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 }) } } } 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 }) } } } |
