diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-07-31 17:43:17 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-07-31 17:58:01 +0200 |
commit | 34bd439378aea107c79b801e6e10502d81d1fd1b (patch) | |
tree | 960582fe47e11a65139172c160a03b0598f1127d /openpgp/src/crypto/mpi.rs | |
parent | 2f80fc49de09879a389ef044352b035396cf7392 (diff) |
openpgp: Improve comparing secret key material.
- Do not explicitly shortcut the iteration by using fold instead of
find.
Diffstat (limited to 'openpgp/src/crypto/mpi.rs')
-rw-r--r-- | openpgp/src/crypto/mpi.rs | 8 |
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) => { |