]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #16775 : jbcrail/rust/fix-rational-docs, r=pcwalton
authorbors <bors@rust-lang.org>
Fri, 5 Sep 2014 15:46:29 +0000 (15:46 +0000)
committerbors <bors@rust-lang.org>
Fri, 5 Sep 2014 15:46:29 +0000 (15:46 +0000)
Minor corrections to Rational documentation.

1  2 
src/libnum/rational.rs

diff --combined src/libnum/rational.rs
index 56f3f532533fe9bbc7db02db0daaf09a0aee37b2,59f559cf19369c99e013aa9f0a8b85d7eae92313..0e334544b4b6c1b305576f583fd64b63b65dcf0b
@@@ -21,7 -21,7 +21,7 @@@ use std::num::{Zero, One, ToStrRadix, F
  use bigint::{BigInt, BigUint, Sign, Plus, Minus};
  
  /// Represents the ratio between 2 numbers.
 -#[deriving(Clone)]
 +#[deriving(Clone, Hash)]
  #[allow(missing_doc)]
  pub struct Ratio<T> {
      numer: T,
@@@ -154,7 -154,7 +154,7 @@@ impl<T: Clone + Integer + PartialOrd
          Ratio::from_integer(self.numer / self.denom)
      }
  
-     ///Returns the fractional part of a number.
+     /// Returns the fractional part of a number.
      #[inline]
      pub fn fract(&self) -> Ratio<T> {
          Ratio::new_raw(self.numer % self.denom, self.denom.clone())
@@@ -243,7 -243,7 +243,7 @@@ macro_rules! arith_impl 
      }
  }
  
- // a/b + c/d = (a*d + b*c)/(b*d
+ // a/b + c/d = (a*d + b*c)/(b*d)
  arith_impl!(impl Add, add)
  
  // a/b - c/d = (a*d - b*c)/(b*d)
@@@ -380,7 -380,6 +380,7 @@@ mod test 
      use super::{Ratio, Rational, BigRational};
      use std::num::{Zero, One, FromStrRadix, FromPrimitive, ToStrRadix};
      use std::from_str::FromStr;
 +    use std::hash::hash;
      use std::num;
  
      pub static _0 : Rational = Ratio { numer: 0, denom: 1};
          assert!(! _neg1_2.is_positive());
          assert!(! _1_2.is_negative());
      }
 +
 +    #[test]
 +    fn test_hash() {
 +        assert!(hash(&_0) != hash(&_1));
 +        assert!(hash(&_0) != hash(&_3_2));
 +    }
  }