mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-30 02:01:35 +00:00
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.
This commit is contained in:
@ -128,7 +128,7 @@ impl hash::Hash for PublicKey {
|
|||||||
|
|
||||||
impl cmp::PartialOrd for PublicKey {
|
impl cmp::PartialOrd for PublicKey {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
||||||
self.0.as_bytes().partial_cmp(other.0.as_bytes())
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ impl hash::Hash for PublicKey {
|
|||||||
|
|
||||||
impl cmp::PartialOrd for PublicKey {
|
impl cmp::PartialOrd for PublicKey {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
||||||
self.to_bytes().partial_cmp(&other.to_bytes())
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user