diff options
| author | Richo Healey <richo@psych0tik.net> | 2014-04-15 18:17:48 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2014-04-18 17:25:34 -0700 |
| commit | 919889a1d688a6bbe2edac8705f048f06b1b455c (patch) | |
| tree | 322a69fa39bdaf37bbfffc84020acbd4c87871d0 /src/libstd/num | |
| parent | b75683cadf6c4c55360202cd6a0106be80532451 (diff) | |
| download | rust-919889a1d688a6bbe2edac8705f048f06b1b455c.tar.gz rust-919889a1d688a6bbe2edac8705f048f06b1b455c.zip | |
Replace all ~"" with "".to_owned()
Diffstat (limited to 'src/libstd/num')
| -rw-r--r-- | src/libstd/num/int_macros.rs | 27 | ||||
| -rw-r--r-- | src/libstd/num/uint_macros.rs | 31 |
2 files changed, 30 insertions, 28 deletions
diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs index 3228b5a1a49..a6b0ccf3a87 100644 --- a/src/libstd/num/int_macros.rs +++ b/src/libstd/num/int_macros.rs @@ -298,6 +298,7 @@ mod tests { use num::Bitwise; use num::CheckedDiv; use num::ToStrRadix; + use str::StrSlice; #[test] fn test_overflows() { @@ -419,39 +420,39 @@ mod tests { #[test] fn test_to_str() { - assert_eq!((0 as $T).to_str_radix(10u), ~"0"); - assert_eq!((1 as $T).to_str_radix(10u), ~"1"); - assert_eq!((-1 as $T).to_str_radix(10u), ~"-1"); - assert_eq!((127 as $T).to_str_radix(16u), ~"7f"); - assert_eq!((100 as $T).to_str_radix(10u), ~"100"); + assert_eq!((0 as $T).to_str_radix(10u), "0".to_owned()); + assert_eq!((1 as $T).to_str_radix(10u), "1".to_owned()); + assert_eq!((-1 as $T).to_str_radix(10u), "-1".to_owned()); + assert_eq!((127 as $T).to_str_radix(16u), "7f".to_owned()); + assert_eq!((100 as $T).to_str_radix(10u), "100".to_owned()); } #[test] fn test_int_to_str_overflow() { let mut i8_val: i8 = 127_i8; - assert_eq!(i8_val.to_str(), ~"127"); + assert_eq!(i8_val.to_str(), "127".to_owned()); i8_val += 1 as i8; - assert_eq!(i8_val.to_str(), ~"-128"); + assert_eq!(i8_val.to_str(), "-128".to_owned()); let mut i16_val: i16 = 32_767_i16; - assert_eq!(i16_val.to_str(), ~"32767"); + assert_eq!(i16_val.to_str(), "32767".to_owned()); i16_val += 1 as i16; - assert_eq!(i16_val.to_str(), ~"-32768"); + assert_eq!(i16_val.to_str(), "-32768".to_owned()); let mut i32_val: i32 = 2_147_483_647_i32; - assert_eq!(i32_val.to_str(), ~"2147483647"); + assert_eq!(i32_val.to_str(), "2147483647".to_owned()); i32_val += 1 as i32; - assert_eq!(i32_val.to_str(), ~"-2147483648"); + assert_eq!(i32_val.to_str(), "-2147483648".to_owned()); let mut i64_val: i64 = 9_223_372_036_854_775_807_i64; - assert_eq!(i64_val.to_str(), ~"9223372036854775807"); + assert_eq!(i64_val.to_str(), "9223372036854775807".to_owned()); i64_val += 1 as i64; - assert_eq!(i64_val.to_str(), ~"-9223372036854775808"); + assert_eq!(i64_val.to_str(), "-9223372036854775808".to_owned()); } #[test] diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index 61723f339ae..9b9aee672a0 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -234,6 +234,7 @@ mod tests { use num::CheckedDiv; use num::Bitwise; use num::ToStrRadix; + use str::StrSlice; use u16; #[test] @@ -274,13 +275,13 @@ mod tests { #[test] pub fn test_to_str() { - assert_eq!((0 as $T).to_str_radix(10u), ~"0"); - assert_eq!((1 as $T).to_str_radix(10u), ~"1"); - assert_eq!((2 as $T).to_str_radix(10u), ~"2"); - assert_eq!((11 as $T).to_str_radix(10u), ~"11"); - assert_eq!((11 as $T).to_str_radix(16u), ~"b"); - assert_eq!((255 as $T).to_str_radix(16u), ~"ff"); - assert_eq!((0xff as $T).to_str_radix(10u), ~"255"); + assert_eq!((0 as $T).to_str_radix(10u), "0".to_owned()); + assert_eq!((1 as $T).to_str_radix(10u), "1".to_owned()); + assert_eq!((2 as $T).to_str_radix(10u), "2".to_owned()); + assert_eq!((11 as $T).to_str_radix(10u), "11".to_owned()); + assert_eq!((11 as $T).to_str_radix(16u), "b".to_owned()); + assert_eq!((255 as $T).to_str_radix(16u), "ff".to_owned()); + assert_eq!((0xff as $T).to_str_radix(10u), "255".to_owned()); } #[test] @@ -313,28 +314,28 @@ mod tests { #[test] fn test_uint_to_str_overflow() { let mut u8_val: u8 = 255_u8; - assert_eq!(u8_val.to_str(), ~"255"); + assert_eq!(u8_val.to_str(), "255".to_owned()); u8_val += 1 as u8; - assert_eq!(u8_val.to_str(), ~"0"); + assert_eq!(u8_val.to_str(), "0".to_owned()); let mut u16_val: u16 = 65_535_u16; - assert_eq!(u16_val.to_str(), ~"65535"); + assert_eq!(u16_val.to_str(), "65535".to_owned()); u16_val += 1 as u16; - assert_eq!(u16_val.to_str(), ~"0"); + assert_eq!(u16_val.to_str(), "0".to_owned()); let mut u32_val: u32 = 4_294_967_295_u32; - assert_eq!(u32_val.to_str(), ~"4294967295"); + assert_eq!(u32_val.to_str(), "4294967295".to_owned()); u32_val += 1 as u32; - assert_eq!(u32_val.to_str(), ~"0"); + assert_eq!(u32_val.to_str(), "0".to_owned()); let mut u64_val: u64 = 18_446_744_073_709_551_615_u64; - assert_eq!(u64_val.to_str(), ~"18446744073709551615"); + assert_eq!(u64_val.to_str(), "18446744073709551615".to_owned()); u64_val += 1 as u64; - assert_eq!(u64_val.to_str(), ~"0"); + assert_eq!(u64_val.to_str(), "0".to_owned()); } #[test] |
