Skip to content

Commit

Permalink
Avoid Self:: for older Rust versions.
Browse files Browse the repository at this point in the history
Also fix a clippy warning.
  • Loading branch information
Timothée Haudebourg committed Oct 20, 2021
1 parent c3ac6c0 commit 9046e3f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ enum N {
impl PartialEq for N {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::PosInt(a), Self::PosInt(b)) => a == b,
(Self::NegInt(a), Self::NegInt(b)) => a == b,
(Self::Float(a), Self::Float(b)) => a == b,
(N::PosInt(a), N::PosInt(b)) => a == b,
(N::NegInt(a), N::NegInt(b)) => a == b,
(N::Float(a), N::Float(b)) => a == b,
_ => false,
}
}
Expand All @@ -51,11 +51,11 @@ impl Eq for N {}
impl core::hash::Hash for N {
fn hash<H: core::hash::Hasher>(&self, h: &mut H) {
match self {
Self::PosInt(i) => i.hash(h),
Self::NegInt(i) => i.hash(h),
Self::Float(f) => {
N::PosInt(i) => i.hash(h),
N::NegInt(i) => i.hash(h),
N::Float(f) => {
// Using `f64::to_bits` here is fine since any float values are always finite.
f.to_bits().hash(h)
f.to_bits().hash(h);
}
}
}
Expand Down

0 comments on commit 9046e3f

Please sign in to comment.