[prev in list] [next in list] [prev in thread] [next in thread]
List: mercurial-devel
Subject: [PATCH 4 of 5] rust: address 'error: unnecessarily eager cloning of iterator items'
From: Mads_Kiilerich <mads () kiilerich ! com>
Date: 2024-01-11 23:59:55
Message-ID: f2e61759ac0e0125e275.1705017595 () lone
[Download RAW message or body]
# HG changeset patch
# User Mads Kiilerich <mads@kiilerich.com>
# Date 1705001854 -3600
# Thu Jan 11 20:37:34 2024 +0100
# Branch stable
# Node ID f2e61759ac0e0125e275acc72bda8a00258762b9
# Parent 8e16bc622b04e2eabb3a47138aa3bdffba03e142
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.
diff --git a/rust/hg-core/src/matchers.rs b/rust/hg-core/src/matchers.rs
--- a/rust/hg-core/src/matchers.rs
+++ b/rust/hg-core/src/matchers.rs
@@ -595,7 +595,7 @@ impl IntersectionMatcher {
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
@@ -688,7 +688,7 @@ impl DifferenceMatcher {
};
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
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@lists.mercurial-scm.org
https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic