rust: address 'error: unnecessarily eager cloning of iterator items' stable
authorMads Kiilerich <mads@kiilerich.com>
Thu, 11 Jan 2024 20:37:34 +0100
branchstable
changeset 52112 71044315a536
parent 52111 747a1370c598
child 52113 b2e90465daf6
child 52119 5ad5f0853a0a
rust: address 'error: unnecessarily eager cloning of iterator items' Build failed with a reference to https://rust-lang.github.io/rust-clippy/master/index.html#iter_overeager_cloned which seems reasonable. There doesn't seem to be any reason to not follow the advice.
rust/hg-core/src/matchers.rs
--- a/rust/hg-core/src/matchers.rs	Mon Jul 22 18:20:03 2024 +0200
+++ b/rust/hg-core/src/matchers.rs	Thu Jan 11 20:37:34 2024 +0100
@@ -617,7 +617,7 @@
                 std::mem::swap(&mut m1, &mut m2);
             }
             m1.file_set().map(|m1_files| {
-                m1_files.iter().cloned().filter(|f| m2.matches(f)).collect()
+                m1_files.iter().filter(|f| m2.matches(f)).cloned().collect()
             })
         } else {
             // without exact input file sets, we can't do an exact
@@ -710,7 +710,7 @@
         };
         if base_is_exact {
             new.files = base_files.map(|files| {
-                files.iter().cloned().filter(|f| new.matches(f)).collect()
+                files.iter().filter(|f| new.matches(f)).cloned().collect()
             });
         }
         new