diff --git a/deps/rust-gmp/gmp.rs b/deps/rust-gmp/gmp.rs index 60df640..e6d99c7 100644 --- a/deps/rust-gmp/gmp.rs +++ b/deps/rust-gmp/gmp.rs @@ -376,7 +376,7 @@ impl Div for Mpz { fn div(&self, other: &Mpz) -> Mpz { unsafe { if other.is_zero() { - fail!(~"divide by zero") + fail!("divide by zero") } let mut res = Mpz::new(); @@ -390,7 +390,7 @@ impl Rem for Mpz { fn rem(&self, other: &Mpz) -> Mpz { unsafe { if other.is_zero() { - fail!(~"divide by zero") + fail!("divide by zero") } let mut res = Mpz::new(); @@ -412,10 +412,10 @@ impl Neg for Mpz { impl ToPrimitive for Mpz { fn to_i64(&self) -> Option { - fail!(~"not implemented") + fail!("not implemented") } fn to_u64(&self) -> Option { - fail!(~"not implemented") + fail!("not implemented") } } @@ -685,7 +685,7 @@ impl Mpq { pub fn invert(&self) -> Mpq { unsafe { if self.is_zero() { - fail!(~"divide by zero") + fail!("divide by zero") } let mut res = Mpq::new(); @@ -761,7 +761,7 @@ impl Div for Mpq { fn div(&self, other: &Mpq) -> Mpq { unsafe { if self.is_zero() { - fail!(~"divide by zero") + fail!("divide by zero") } let mut res = Mpq::new(); @@ -783,10 +783,10 @@ impl Neg for Mpq { impl ToPrimitive for Mpq { fn to_i64(&self) -> Option { - fail!(~"not implemented") + fail!("not implemented") } fn to_u64(&self) -> Option { - fail!(~"not implemented") + fail!("not implemented") } } @@ -960,7 +960,7 @@ impl Div for Mpf { fn div(&self, other: &Mpf) -> Mpf { unsafe { if __gmpf_cmp_ui(&self.mpf, 0) == 0 { - fail!(~"divide by zero") + fail!("divide by zero") } let mut res = Mpf::new(cmp::max(self.get_prec() as uint, @@ -1107,13 +1107,13 @@ mod test_mpz { #[test] fn test_to_str_radix() { let x: Mpz = FromPrimitive::from_int(255).unwrap(); - assert!(x.to_str_radix(16) == ~"ff"); + assert!(x.to_str_radix(16).as_slice() == "ff"); } #[test] fn test_to_str() { let x: Mpz = FromStr::from_str("1234567890").unwrap(); - assert!(x.to_str() == ~"1234567890"); + assert!(x.to_str().as_slice() == "1234567890"); } #[test] @@ -1134,7 +1134,7 @@ mod test_mpz { #[test] fn test_from_int() { let x: Mpz = FromPrimitive::from_int(150).unwrap(); - assert!(x.to_str() == ~"150"); + assert!(x.to_str().as_slice() == "150"); assert!(x == FromStr::from_str("150").unwrap()); } diff --git a/src/bignum/lib.rs b/src/bignum/lib.rs index cefbfd7..2de3fc4 100644 --- a/src/bignum/lib.rs +++ b/src/bignum/lib.rs @@ -365,25 +365,25 @@ mod test_biguint { #[test] fn test_from_primitive() { let two: BigUint = FromPrimitive::from_uint(2).unwrap(); - assert_eq!(two.to_str(), ~"2"); + assert_eq!(two.to_str().as_slice(), "2"); } #[test] fn test_from_str() { let two: BigUint = FromStr::from_str("2").unwrap(); - assert_eq!(two.to_str(), ~"2"); + assert_eq!(two.to_str().as_slice(), "2"); } #[test] fn test_from_str_radix() { let two = BigUint::from_str_radix("1a", 16).unwrap(); - assert_eq!(two.to_str(), ~"26"); + assert_eq!(two.to_str().as_slice(), "26"); } #[test] fn test_to_biguint() { let three = 3u.to_biguint().unwrap(); - assert_eq!(three.to_str(), ~"3"); + assert_eq!(three.to_str().as_slice(), "3"); } #[test] @@ -411,8 +411,8 @@ mod test_biguint { fn test_zero_and_one() { let zero: BigUint = Zero::zero(); let one: BigUint = One::one(); - assert_eq!(zero.to_str(), ~"0"); - assert_eq!(one.to_str(), ~"1"); + assert_eq!(zero.to_str().as_slice(), "0"); + assert_eq!(one.to_str().as_slice(), "1"); } #[test] @@ -436,8 +436,8 @@ mod test_biguint { let two: BigUint = FromPrimitive::from_uint(2).unwrap(); let three: BigUint = FromPrimitive::from_uint(3).unwrap(); - assert_eq!(two.add(&three).to_str(), ~"5"); - assert_eq!((two + three).to_str(), ~"5"); + assert_eq!(two.add(&three).to_str().as_slice(), "5"); + assert_eq!((two + three).to_str().as_slice(), "5"); } #[test] @@ -445,8 +445,8 @@ mod test_biguint { let two: BigUint = FromPrimitive::from_uint(2).unwrap(); let three: BigUint = FromPrimitive::from_uint(3).unwrap(); - assert_eq!(three.sub(&two).to_str(), ~"1"); - assert_eq!((three - two).to_str(), ~"1"); + assert_eq!(three.sub(&two).to_str().as_slice(), "1"); + assert_eq!((three - two).to_str().as_slice(), "1"); } #[test] @@ -454,8 +454,8 @@ mod test_biguint { let two: BigUint = FromPrimitive::from_uint(2).unwrap(); let three: BigUint = FromPrimitive::from_uint(3).unwrap(); - assert_eq!(two.mul(&three).to_str(), ~"6"); - assert_eq!((two * three).to_str(), ~"6"); + assert_eq!(two.mul(&three).to_str().as_slice(), "6"); + assert_eq!((two * three).to_str().as_slice(), "6"); } #[test] @@ -569,15 +569,15 @@ mod test_bigint { fn test_zero_and_one() { let zero: BigInt = Zero::zero(); let one: BigInt = One::one(); - assert_eq!(zero.to_str(), ~"0"); - assert_eq!(one.to_str(), ~"1"); + assert_eq!(zero.to_str().as_slice(), "0"); + assert_eq!(one.to_str().as_slice(), "1"); } #[test] fn test_to_biguint() { let three: BigInt = FromPrimitive::from_int(3).unwrap(); let minusthree: BigInt = FromPrimitive::from_int(-3).unwrap(); - assert_eq!(three.to_biguint().unwrap().to_str(), ~"3"); + assert_eq!(three.to_biguint().unwrap().to_str().as_slice(), "3"); assert_eq!(minusthree.to_biguint(), None); } @@ -586,8 +586,8 @@ mod test_bigint { let two: BigInt = FromPrimitive::from_uint(2).unwrap(); let three: BigInt = FromPrimitive::from_uint(3).unwrap(); - assert_eq!(two.add(&three).to_str(), ~"5"); - assert_eq!((two + three).to_str(), ~"5"); + assert_eq!(two.add(&three).to_str().as_slice(), "5"); + assert_eq!((two + three).to_str().as_slice(), "5"); } #[test] @@ -595,8 +595,8 @@ mod test_bigint { let two: BigInt = FromPrimitive::from_uint(2).unwrap(); let three: BigInt = FromPrimitive::from_uint(3).unwrap(); - assert_eq!(three.sub(&two).to_str(), ~"1"); - assert_eq!((three - two).to_str(), ~"1"); + assert_eq!(three.sub(&two).to_str().as_slice(), "1"); + assert_eq!((three - two).to_str().as_slice(), "1"); } #[test] @@ -604,8 +604,8 @@ mod test_bigint { let two: BigInt = FromPrimitive::from_uint(2).unwrap(); let three: BigInt = FromPrimitive::from_uint(3).unwrap(); - assert_eq!(two.mul(&three).to_str(), ~"6"); - assert_eq!((two * three).to_str(), ~"6"); + assert_eq!(two.mul(&three).to_str().as_slice(), "6"); + assert_eq!((two * three).to_str().as_slice(), "6"); } #[test]