Removed PartialEq,PartialOrd impls, shouldn't be manually impl when Hash is derived

This commit is contained in:
Elichai Turkel 2019-08-05 15:44:32 -04:00
parent a473d01b17
commit 2cc88a99aa
No known key found for this signature in database
GPG Key ID: 9383CDE9E8E66A7F
1 changed files with 2 additions and 40 deletions

View File

@ -274,7 +274,7 @@ fn fmt_satoshi_in(
/// zero is considered an underflow and will cause a panic if you're not using /// zero is considered an underflow and will cause a panic if you're not using
/// the checked arithmetic methods. /// the checked arithmetic methods.
/// ///
#[derive(Copy, Clone, Hash)] #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Amount(u64); pub struct Amount(u64);
impl Amount { impl Amount {
@ -445,25 +445,6 @@ impl default::Default for Amount {
} }
} }
impl PartialEq for Amount {
fn eq(&self, other: &Amount) -> bool {
PartialEq::eq(&self.0, &other.0)
}
}
impl Eq for Amount {}
impl PartialOrd for Amount {
fn partial_cmp(&self, other: &Amount) -> Option<::std::cmp::Ordering> {
PartialOrd::partial_cmp(&self.0, &other.0)
}
}
impl Ord for Amount {
fn cmp(&self, other: &Amount) -> ::std::cmp::Ordering {
Ord::cmp(&self.0, &other.0)
}
}
impl fmt::Debug for Amount { impl fmt::Debug for Amount {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Amount({} satoshi)", self.as_sat()) write!(f, "Amount({} satoshi)", self.as_sat())
@ -571,7 +552,7 @@ impl FromStr for Amount {
/// start with `checked_`. The operations from [std::ops] that [Amount] /// start with `checked_`. The operations from [std::ops] that [Amount]
/// implements will panic when overflow or underflow occurs. /// implements will panic when overflow or underflow occurs.
/// ///
#[derive(Copy, Clone, Hash)] #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct SignedAmount(i64); pub struct SignedAmount(i64);
impl SignedAmount { impl SignedAmount {
@ -789,25 +770,6 @@ impl default::Default for SignedAmount {
} }
} }
impl PartialEq for SignedAmount {
fn eq(&self, other: &SignedAmount) -> bool {
PartialEq::eq(&self.0, &other.0)
}
}
impl Eq for SignedAmount {}
impl PartialOrd for SignedAmount {
fn partial_cmp(&self, other: &SignedAmount) -> Option<::std::cmp::Ordering> {
PartialOrd::partial_cmp(&self.0, &other.0)
}
}
impl Ord for SignedAmount {
fn cmp(&self, other: &SignedAmount) -> ::std::cmp::Ordering {
Ord::cmp(&self.0, &other.0)
}
}
impl fmt::Debug for SignedAmount { impl fmt::Debug for SignedAmount {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "SignedAmount({} satoshi)", self.as_sat()) write!(f, "SignedAmount({} satoshi)", self.as_sat())