summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortummychow <tummychow@users.noreply.github.com>2018-02-25 23:43:54 -0800
committertummychow <tummychow@users.noreply.github.com>2018-02-25 23:43:54 -0800
commitd18a973d57ee770444e7ed183a544e6cd2e70c7c (patch)
tree7ce490a6c848211af0f4cacb0ad5c57832010970
parent0b5568c73b95c34b4ff98b0565b0e8533e3a19a1 (diff)
tweak uniform to take an IntoIterator
maybe this is just a stylistic tweak? not sure if there are norms or recommendations here but i like this more
-rw-r--r--src/commute.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/commute.rs b/src/commute.rs
index ac43fe6..87bb866 100644
--- a/src/commute.rs
+++ b/src/commute.rs
@@ -43,11 +43,12 @@ fn anchors(hunk: &owned::Hunk) -> (usize, usize, usize, usize) {
///
/// `uniform()` is short-circuiting. It will stop processing as soon
/// as it finds two pairwise inequal elements.
-fn uniform<I, E>(mut iter: I) -> bool
+fn uniform<I, E>(iter: I) -> bool
where
- I: iter::Iterator<Item = E>,
+ I: iter::IntoIterator<Item = E>,
E: ::std::cmp::Eq,
{
+ let mut iter = iter.into_iter();
match iter.next() {
Some(first) => iter.all(|e| e == first),
None => true,