summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-07-31 17:43:17 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-07-31 17:58:01 +0200
commit34bd439378aea107c79b801e6e10502d81d1fd1b (patch)
tree960582fe47e11a65139172c160a03b0598f1127d
parent2f80fc49de09879a389ef044352b035396cf7392 (diff)
openpgp: Improve comparing secret key material.
- Do not explicitly shortcut the iteration by using fold instead of find.
-rw-r--r--openpgp/src/crypto/mpi.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/openpgp/src/crypto/mpi.rs b/openpgp/src/crypto/mpi.rs
index 6814e61f..d7e91d2c 100644
--- a/openpgp/src/crypto/mpi.rs
+++ b/openpgp/src/crypto/mpi.rs
@@ -673,11 +673,9 @@ impl PartialOrd for SecretKeyMaterial {
a.cmp(b)
}).collect::<Vec<_>>();
- iter::once(&o1)
- .chain(on.iter())
- .find(|&&x| x != Ordering::Equal)
- .cloned()
- .unwrap_or(Ordering::Equal)
+ iter::once(o1)
+ .chain(on.iter().cloned())
+ .fold(Ordering::Equal, |acc, x| acc.then(x))
}
(a, b) => {