From e1bfeacba06171d4570a7ceb873ffdb481f5d47d Mon Sep 17 00:00:00 2001 From: vasilito Date: Sat, 18 Jul 2026 18:08:14 +0900 Subject: [PATCH] refactor: fix last 4 clippy warnings (if_same_then_else, too_many_arguments) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reduced warnings from 4 to 0 — cookbook lib is now clippy-clean. Changes: - if_same_then_else (1): combined identical Ok(list) branches with || in staged_pkg.rs new_recursive() - too_many_arguments (3): added #[allow(clippy::too_many_arguments)] with justification comments (required by AGENTS.md WARNING POLICY) on display_tree_entry, walk_tree_entry, new_recursive — params are genuinely independent display/traversal/recursion options Verification: cargo check ✅, cargo test --lib ✅ 38/38, cargo clippy 0 warnings. --- src/cook/tree.rs | 2 ++ src/recipe.rs | 1 + src/staged_pkg.rs | 4 +--- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cook/tree.rs b/src/cook/tree.rs index b1a6a82b34..4832c2d0fc 100644 --- a/src/cook/tree.rs +++ b/src/cook/tree.rs @@ -16,6 +16,7 @@ pub enum WalkTreeEntry<'a> { Missing, } +#[allow(clippy::too_many_arguments)] // params are independent display options pub fn display_tree_entry( package_name: &PackageName, recipe_map: &HashMap<&PackageName, &CookRecipe>, @@ -39,6 +40,7 @@ pub fn display_tree_entry( ) } +#[allow(clippy::too_many_arguments)] // params are independent traversal options pub fn walk_tree_entry( package_name: &PackageName, recipe_map: &HashMap<&PackageName, &CookRecipe>, diff --git a/src/recipe.rs b/src/recipe.rs index 9bc2cf371b..3850d5e367 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -275,6 +275,7 @@ impl CookRecipe { Self::new(name, dir.to_path_buf(), recipe) } + #[allow(clippy::too_many_arguments)] // params are independent recursion flags fn new_recursive( names: &[PackageName], recurse_build_deps: bool, diff --git a/src/staged_pkg.rs b/src/staged_pkg.rs index db5943d431..00eac51fdb 100644 --- a/src/staged_pkg.rs +++ b/src/staged_pkg.rs @@ -97,9 +97,7 @@ pub fn new_recursive( return Ok(vec![]); } let (list, map) = new_recursive_nonstop(names, recursion); - if nonstop && !list.is_empty() { - Ok(list) - } else if !nonstop && map.len() == list.len() { + if (nonstop && !list.is_empty()) || (!nonstop && map.len() == list.len()) { Ok(list) } else { let (_, res) = map.into_iter().find(|(_, v)| v.is_err()).unwrap();