mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 20:31:19 -03:00
Fix eager cloning
https://rust-lang.github.io/rust-clippy/master/index.html#iter_overeager_cloned
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user