aboutsummaryrefslogtreecommitdiff
path: root/mingling_pathf/src/patterns
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-02 04:22:30 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-02 04:22:30 +0800
commit8128f2c94313b2e9b9d0b5c3350623f77bbb2521 (patch)
tree9e542eeaaae148b8cccaa01608d75ed1fc463869 /mingling_pathf/src/patterns
parent3f24e5b6ead1e153408ae5e58ad34636fe614645 (diff)
chore: run cargo fmt and rearrange re-exports in minglingnext
Diffstat (limited to 'mingling_pathf/src/patterns')
-rw-r--r--mingling_pathf/src/patterns/chain.rs9
-rw-r--r--mingling_pathf/src/patterns/completion.rs9
-rw-r--r--mingling_pathf/src/patterns/help.rs9
-rw-r--r--mingling_pathf/src/patterns/pack.rs22
-rw-r--r--mingling_pathf/src/patterns/renderer.rs9
5 files changed, 24 insertions, 34 deletions
diff --git a/mingling_pathf/src/patterns/chain.rs b/mingling_pathf/src/patterns/chain.rs
index 10d698e..d64ed3b 100644
--- a/mingling_pathf/src/patterns/chain.rs
+++ b/mingling_pathf/src/patterns/chain.rs
@@ -63,10 +63,7 @@ fn collect_from_item(item: &Item, current_mod: &str, items: &mut Vec<AnalyzeItem
}
fn has_attr(attrs: &[syn::Attribute], name: &str) -> bool {
- attrs.iter().any(|a| {
- a.path()
- .segments
- .last()
- .is_some_and(|s| s.ident == name)
- })
+ attrs
+ .iter()
+ .any(|a| a.path().segments.last().is_some_and(|s| s.ident == name))
}
diff --git a/mingling_pathf/src/patterns/completion.rs b/mingling_pathf/src/patterns/completion.rs
index 7e4cd09..ff20e0f 100644
--- a/mingling_pathf/src/patterns/completion.rs
+++ b/mingling_pathf/src/patterns/completion.rs
@@ -56,10 +56,7 @@ fn collect_from_item(item: &Item, current_mod: &str, items: &mut Vec<AnalyzeItem
}
fn has_attr(attrs: &[syn::Attribute], name: &str) -> bool {
- attrs.iter().any(|a| {
- a.path()
- .segments
- .last()
- .is_some_and(|s| s.ident == name)
- })
+ attrs
+ .iter()
+ .any(|a| a.path().segments.last().is_some_and(|s| s.ident == name))
}
diff --git a/mingling_pathf/src/patterns/help.rs b/mingling_pathf/src/patterns/help.rs
index 357626b..02bfa4f 100644
--- a/mingling_pathf/src/patterns/help.rs
+++ b/mingling_pathf/src/patterns/help.rs
@@ -56,10 +56,7 @@ fn collect_from_item(item: &Item, current_mod: &str, items: &mut Vec<AnalyzeItem
}
fn has_attr(attrs: &[syn::Attribute], name: &str) -> bool {
- attrs.iter().any(|a| {
- a.path()
- .segments
- .last()
- .is_some_and(|s| s.ident == name)
- })
+ attrs
+ .iter()
+ .any(|a| a.path().segments.last().is_some_and(|s| s.ident == name))
}
diff --git a/mingling_pathf/src/patterns/pack.rs b/mingling_pathf/src/patterns/pack.rs
index f025f7d..83c1cee 100644
--- a/mingling_pathf/src/patterns/pack.rs
+++ b/mingling_pathf/src/patterns/pack.rs
@@ -40,12 +40,13 @@ impl AnalyzePattern for PackPattern {
if let Some((_, nested)) = &item_mod.content {
for n in nested {
if let Item::Macro(m) = n
- && let Some(name) = try_extract_pack_name(m) {
- items.push(AnalyzeItem {
- module: item_mod.ident.to_string(),
- item_name: name,
- });
- }
+ && let Some(name) = try_extract_pack_name(m)
+ {
+ items.push(AnalyzeItem {
+ module: item_mod.ident.to_string(),
+ item_name: name,
+ });
+ }
}
}
}
@@ -89,10 +90,11 @@ fn try_extract_pack_name(m: &syn::ItemMacro) -> Option<String> {
// Check if `=` follows
if let Some(proc_macro2::TokenTree::Punct(p)) = iter.next()
- && p.as_char() == '=' {
- // pack!(TypeName = InnerType)
- return Some(type_name);
- }
+ && p.as_char() == '='
+ {
+ // pack!(TypeName = InnerType)
+ return Some(type_name);
+ }
// pack_err!(TypeName) — only a single ident
return Some(type_name);
diff --git a/mingling_pathf/src/patterns/renderer.rs b/mingling_pathf/src/patterns/renderer.rs
index 410ae14..054769e 100644
--- a/mingling_pathf/src/patterns/renderer.rs
+++ b/mingling_pathf/src/patterns/renderer.rs
@@ -56,10 +56,7 @@ fn collect_from_item(item: &Item, current_mod: &str, items: &mut Vec<AnalyzeItem
}
fn has_attr(attrs: &[syn::Attribute], name: &str) -> bool {
- attrs.iter().any(|a| {
- a.path()
- .segments
- .last()
- .is_some_and(|s| s.ident == name)
- })
+ attrs
+ .iter()
+ .any(|a| a.path().segments.last().is_some_and(|s| s.ident == name))
}