From 03b487f0f93ac32835149d4c1a0fb420341134f8 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 10 Aug 2026 16:30:20 +0800 Subject: 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 --- mingling_pathf/src/patterns/metadata.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mingling_pathf/src/patterns/metadata.rs') diff --git a/mingling_pathf/src/patterns/metadata.rs b/mingling_pathf/src/patterns/metadata.rs index 24243bf..32a283a 100644 --- a/mingling_pathf/src/patterns/metadata.rs +++ b/mingling_pathf/src/patterns/metadata.rs @@ -95,7 +95,7 @@ fn extract_bind_type(attrs: &[syn::Attribute]) -> Option { continue; } if let syn::Meta::List(meta_list) = &attr.meta { - for token in meta_list.tokens.clone().into_iter() { + for token in meta_list.tokens.clone() { if let proc_macro2::TokenTree::Ident(ident) = token { return Some(ident.to_string()); } @@ -139,7 +139,8 @@ fn collect_from_use_tree( UseTree::Name(name) => { let module = prefix.to_string(); let alias = name.ident.to_string(); - map.entry(alias).or_insert((module, name.ident.to_string())); + map.entry(alias) + .or_insert_with(|| (module, name.ident.to_string())); } UseTree::Path(use_path) => { let new_prefix = if prefix.is_empty() { @@ -153,7 +154,7 @@ fn collect_from_use_tree( let module = prefix.to_string(); let alias = rename.ident.to_string(); map.entry(alias) - .or_insert((module, rename.ident.to_string())); + .or_insert_with(|| (module, rename.ident.to_string())); } UseTree::Glob(_) => {} UseTree::Group(group) => { -- cgit