Skip to content

Commit

Permalink
Use is_one.
Browse files Browse the repository at this point in the history
  • Loading branch information
clarfonthey committed Mar 8, 2018
1 parent 2470983 commit b416609
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Expand Up @@ -105,7 +105,7 @@ impl<T: Clone + Integer> Ratio<T> {
/// Returns true if the rational number is an integer (denominator is 1).
#[inline]
pub fn is_integer(&self) -> bool {
self.denom == One::one()
self.denom.is_one()
}

/// Puts self into lowest terms, with denom > 0.
Expand Down Expand Up @@ -839,7 +839,7 @@ impl<T> fmt::Display for Ratio<T>
{
/// Renders as `numer/denom`. If denom=1, renders as numer.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.denom == One::one() {
if self.denom.is_one() {
write!(f, "{}", self.numer)
} else {
write!(f, "{}/{}", self.numer, self.denom)
Expand Down

0 comments on commit b416609

Please sign in to comment.