From a138bc328b1943253752da72ecb98bae96f371c0 Mon Sep 17 00:00:00 2001 From: Daniel Rainer Date: Sat, 7 Jun 2025 00:22:52 +0200 Subject: [PATCH] Fix eager cloning https://rust-lang.github.io/rust-clippy/master/index.html#iter_overeager_cloned --- src/builtins/path.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/builtins/path.rs b/src/builtins/path.rs index 14fd29125..d440c795a 100644 --- a/src/builtins/path.rs +++ b/src/builtins/path.rs @@ -885,10 +885,14 @@ fn path_filter_maybe_is( // Collect arguments into a Vec so we can use .len() let arguments_vec: Vec<_> = arguments.collect(); - for (arg, _) in arguments_vec.iter().cloned().filter(|(f, _)| { - (opts.perms.is_none() && opts.types.is_none()) - || (filter_path(&opts, f, uid, gid) != opts.invert) - }) { + for (arg, _) in arguments_vec + .iter() + .filter(|&(f, _)| { + (opts.perms.is_none() && opts.types.is_none()) + || (filter_path(&opts, f, uid, gid) != opts.invert) + }) + .cloned() + { // If we don't have filters, check if it exists. if opts.perms.is_none() && opts.types.is_none() { let ok = waccess(&arg, F_OK) == 0;