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.
--- 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