From 2fe5dbd9a3e71da6cf8d3ef500a54411e23a8514 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 6 Apr 2026 16:01:00 +0800 Subject: Add check_all script and simplify attribute parsing --- check_all.sh | 19 +++++++++++++++++++ mingling_macros/src/groupped.rs | 14 ++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) create mode 100755 check_all.sh diff --git a/check_all.sh b/check_all.sh new file mode 100755 index 0000000..3ab7d9e --- /dev/null +++ b/check_all.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Change to the directory where the script is located +cd "$(dirname "$0")" + +# Run cargo clippy in mingling_core +cd mingling_core +cargo clippy --fix --allow-dirty +cd .. + +# Run cargo clippy in mingling_macros +cd mingling_macros +cargo clippy --fix --allow-dirty +cd .. + +# Run cargo clippy in mingling +cd mingling +cargo clippy --fix --allow-dirty +cd .. 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 { for attr in attrs { - if attr.path().is_ident("group") { - if let Ok(meta) = attr.parse_args::() { - 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::() + && let syn::Meta::Path(path) = meta + && let Some(segment) = path.segments.last() + { + return Some(segment.ident.clone()); } } None -- cgit