diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-04-06 16:01:00 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-04-06 16:01:00 +0800 |
| commit | 2fe5dbd9a3e71da6cf8d3ef500a54411e23a8514 (patch) | |
| tree | 3472c12b87eaa260775a662d874385e7012c079d /mingling_macros/src/groupped.rs | |
| parent | 9f8307ad9b0f1ce8301698277d2b8ab169ea5f7f (diff) | |
Add check_all script and simplify attribute parsing
Diffstat (limited to 'mingling_macros/src/groupped.rs')
| -rw-r--r-- | mingling_macros/src/groupped.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/mingling_macros/src/groupped.rs b/mingling_macros/src/groupped.rs index 187ea46..2f9934f 100644 --- a/mingling_macros/src/groupped.rs +++ b/mingling_macros/src/groupped.rs @@ -11,14 +11,12 @@ use syn::{Attribute, DeriveInput, Ident, parse_macro_input}; /// Parses the `#[group(...)]` attribute to extract the group type fn parse_group_attribute(attrs: &[Attribute]) -> Option<Ident> { for attr in attrs { - if attr.path().is_ident("group") { - if let Ok(meta) = attr.parse_args::<syn::Meta>() { - if let syn::Meta::Path(path) = meta { - if let Some(segment) = path.segments.last() { - return Some(segment.ident.clone()); - } - } - } + if attr.path().is_ident("group") + && let Ok(meta) = attr.parse_args::<syn::Meta>() + && let syn::Meta::Path(path) = meta + && let Some(segment) = path.segments.last() + { + return Some(segment.ident.clone()); } } None |
