From 3bce9ebddff4a5b0bc0c2b6704fc11e773aa942c Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Thu, 24 Aug 2023 08:01:19 +0200 Subject: [PATCH] refactor(identity): fix clippy beta lint From the lint documentation: > If both `PartialOrd` and `Ord` are implemented, they must agree. This is commonly done by wrapping the result of `cmp` in `Some` for `partial_cmp`. Not doing this may silently introduce an error upon refactoring. Pull-Request: #4379. --- identity/src/ed25519.rs | 2 +- identity/src/secp256k1.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/identity/src/ed25519.rs b/identity/src/ed25519.rs index 23d11932..06708ce6 100644 --- a/identity/src/ed25519.rs +++ b/identity/src/ed25519.rs @@ -128,7 +128,7 @@ impl hash::Hash for PublicKey { impl cmp::PartialOrd for PublicKey { fn partial_cmp(&self, other: &Self) -> Option { - self.0.as_bytes().partial_cmp(other.0.as_bytes()) + Some(self.cmp(other)) } } diff --git a/identity/src/secp256k1.rs b/identity/src/secp256k1.rs index a32a64e7..94b9b917 100644 --- a/identity/src/secp256k1.rs +++ b/identity/src/secp256k1.rs @@ -178,7 +178,7 @@ impl hash::Hash for PublicKey { impl cmp::PartialOrd for PublicKey { fn partial_cmp(&self, other: &Self) -> Option { - self.to_bytes().partial_cmp(&other.to_bytes()) + Some(self.cmp(other)) } }