Skip to content

Commit 6e68c12

Browse files
committed
Don't need manual Ord and PartialOrd
The derived versions are the same.
1 parent aa4c8ce commit 6e68c12

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

src/blockhash.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
//! Block hash address type.
1515
16-
use std::cmp::Ordering;
1716
use std::fmt;
1817
use std::fmt::{Debug, Display};
1918
use std::hash::{Hash, Hasher};
@@ -28,7 +27,7 @@ use crate::*;
2827
///
2928
/// Stored in memory as compact bytes, but translatable to and from
3029
/// hex strings.
31-
#[derive(Clone, Deserialize, Serialize)]
30+
#[derive(Clone, Deserialize, Serialize, PartialOrd, Ord)]
3231
#[serde(into = "String")]
3332
#[serde(try_from = "&str")]
3433
pub struct BlockHash {
@@ -105,18 +104,6 @@ impl From<Blake2bResult> for BlockHash {
105104
}
106105
}
107106

108-
impl Ord for BlockHash {
109-
fn cmp(&self, other: &Self) -> Ordering {
110-
self.bin.cmp(&other.bin)
111-
}
112-
}
113-
114-
impl PartialOrd for BlockHash {
115-
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
116-
Some(self.bin.cmp(&other.bin))
117-
}
118-
}
119-
120107
impl PartialEq for BlockHash {
121108
fn eq(&self, other: &Self) -> bool {
122109
self.bin[..] == other.bin[..]

0 commit comments

Comments
 (0)