diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-10 16:30:20 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-10 16:30:20 +0800 |
| commit | 03b487f0f93ac32835149d4c1a0fb420341134f8 (patch) | |
| tree | 80e3e901c054581dcffc09da471053d15eb12560 /mingling_pathf/src/patterns/pack.rs | |
| parent | 1be60c990f27cd9006fa3db8aa5bd623c33840e8 (diff) | |
feat(pathf): enforce pedantic lints and update API ergonomics
- Add `#[must_use]` to public constructors and getters
- Change `init_with_config` to accept `&PathfinderConfig` instead of
owned value
- Refactor `map_or_else` and `or_insert_with` for clippy compliance
- Add `#![deny(clippy::pedantic)]` and `#![deny(clippy::nursery)]`
- Document error cases in public API docs
- Simplify duplicated dispatcher_clap analysis logic
Diffstat (limited to 'mingling_pathf/src/patterns/pack.rs')
| -rw-r--r-- | mingling_pathf/src/patterns/pack.rs | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/mingling_pathf/src/patterns/pack.rs b/mingling_pathf/src/patterns/pack.rs index 76597ba..e5e14e6 100644 --- a/mingling_pathf/src/patterns/pack.rs +++ b/mingling_pathf/src/patterns/pack.rs @@ -84,23 +84,20 @@ fn try_extract_pack_name(m: &syn::ItemMacro) -> Option<String> { // Skip leading attributes/doc comments loop { - match iter.next()? { - proc_macro2::TokenTree::Ident(ident) => { - // Found the first ident, this is the type name - let type_name = ident.to_string(); - - // Check if `=` follows - if let Some(proc_macro2::TokenTree::Punct(p)) = iter.next() - && p.as_char() == '=' - { - // pack!(TypeName = InnerType) - return Some(type_name); - } - - // pack_err!(TypeName) — only a single ident + if let proc_macro2::TokenTree::Ident(ident) = iter.next()? { + // Found the first ident, this is the type name + let type_name = ident.to_string(); + + // Check if `=` follows + if let Some(proc_macro2::TokenTree::Punct(p)) = iter.next() + && p.as_char() == '=' + { + // pack!(TypeName = InnerType) return Some(type_name); } - _ => continue, + + // pack_err!(TypeName) — only a single ident + return Some(type_name); } } } |
