diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-08-17 22:47:54 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-08-20 22:05:03 -0400 |
| commit | 46fc549fa98d473f925b04e53d08f26c2e15bc2a (patch) | |
| tree | ece6425698c9bf30a637e4cffc5b5a4fb721083b /src/test | |
| parent | 0d72f604b7da4f03e7b30466af6b8b55f16c207b (diff) | |
| download | rust-46fc549fa98d473f925b04e53d08f26c2e15bc2a.tar.gz rust-46fc549fa98d473f925b04e53d08f26c2e15bc2a.zip | |
rm obsolete integer to_str{,_radix} free functions
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/bench/core-set.rs | 12 | ||||
| -rw-r--r-- | src/test/bench/core-uint-to-str.rs | 2 | ||||
| -rw-r--r-- | src/test/bench/shootout-pfib.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/monad.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/reflect-visit-data.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/static-impl.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/trait-generic.rs | 10 | ||||
| -rw-r--r-- | src/test/run-pass/trait-to-str.rs | 23 |
8 files changed, 22 insertions, 33 deletions
diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index 70fe6f706f7..22622c1cac3 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -89,13 +89,11 @@ impl Results { let mut set = f(); do timed(&mut self.sequential_strings) { for i in range(0u, num_keys) { - let s = uint::to_str(i); - set.insert(s); + set.insert(i.to_str()); } for i in range(0u, num_keys) { - let s = uint::to_str(i); - assert!(set.contains(&s)); + assert!(set.contains(&i.to_str())); } } } @@ -104,7 +102,7 @@ impl Results { let mut set = f(); do timed(&mut self.random_strings) { for _ in range(0, num_keys) { - let s = uint::to_str(rng.next() as uint); + let s = (rng.next() as uint).to_str(); set.insert(s); } } @@ -113,11 +111,11 @@ impl Results { { let mut set = f(); for i in range(0u, num_keys) { - set.insert(uint::to_str(i)); + set.insert(i.to_str()); } do timed(&mut self.delete_strings) { for i in range(0u, num_keys) { - assert!(set.remove(&uint::to_str(i))); + assert!(set.remove(&i.to_str())); } } } diff --git a/src/test/bench/core-uint-to-str.rs b/src/test/bench/core-uint-to-str.rs index 4a32fda59d8..4869c486e5e 100644 --- a/src/test/bench/core-uint-to-str.rs +++ b/src/test/bench/core-uint-to-str.rs @@ -24,7 +24,7 @@ fn main() { let n = uint::from_str(args[1]).unwrap(); for i in range(0u, n) { - let x = uint::to_str(i); + let x = i.to_str(); info!(x); } } diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 611b11560e4..b2491e305b2 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -125,7 +125,7 @@ fn main() { let elapsed = stop - start; out.write_line(fmt!("%d\t%d\t%s", n, fibn, - u64::to_str(elapsed))); + elapsed.to_str())); } } } diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index 4529ebf831f..7dc859e559e 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -40,7 +40,7 @@ impl<A> option_monad<A> for Option<A> { } fn transform(x: Option<int>) -> Option<~str> { - x.bind(|n| Some(*n + 1) ).bind(|n| Some(int::to_str(*n)) ) + x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_str()) ) } pub fn main() { diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs index 8ab1bef286c..72bdc2ee0a6 100644 --- a/src/test/run-pass/reflect-visit-data.rs +++ b/src/test/run-pass/reflect-visit-data.rs @@ -529,7 +529,7 @@ impl TyVisitor for my_visitor { } fn visit_int(&self) -> bool { do self.get::<int>() |i| { - self.vals.push(int::to_str(i)); + self.vals.push(i.to_str()); }; true } diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index e2bf525df1a..520b3583195 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -32,7 +32,7 @@ trait uint_utils { } impl uint_utils for uint { - fn str(&self) -> ~str { uint::to_str(*self) } + fn str(&self) -> ~str { self.to_str() } fn multi(&self, f: &fn(uint)) { let mut c = 0u; while c < *self { f(c); c += 1u; } diff --git a/src/test/run-pass/trait-generic.rs b/src/test/run-pass/trait-generic.rs index 47d9665217c..6916db28e11 100644 --- a/src/test/run-pass/trait-generic.rs +++ b/src/test/run-pass/trait-generic.rs @@ -13,16 +13,16 @@ use std::int; trait to_str { - fn to_str(&self) -> ~str; + fn to_string(&self) -> ~str; } impl to_str for int { - fn to_str(&self) -> ~str { int::to_str(*self) } + fn to_string(&self) -> ~str { self.to_str() } } impl to_str for ~str { - fn to_str(&self) -> ~str { self.clone() } + fn to_string(&self) -> ~str { self.clone() } } impl to_str for () { - fn to_str(&self) -> ~str { ~"()" } + fn to_string(&self) -> ~str { ~"()" } } trait map<T> { @@ -43,7 +43,7 @@ fn foo<U, T: map<U>>(x: T) -> ~[~str] { x.map(|_e| ~"hi" ) } fn bar<U:to_str,T:map<U>>(x: T) -> ~[~str] { - x.map(|_e| _e.to_str() ) + x.map(|_e| _e.to_string() ) } pub fn main() { diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs index 8982b35ff33..8ecad8d4fe1 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -10,35 +10,26 @@ // xfail-fast -#[no_std]; - -extern mod std; - -use std::str::StrVector; -use std::vec::ImmutableVector; -use std::iterator::Iterator; -use std::int; - trait to_str { - fn to_str(&self) -> ~str; + fn to_string(&self) -> ~str; } impl to_str for int { - fn to_str(&self) -> ~str { int::to_str(*self) } + fn to_string(&self) -> ~str { self.to_str() } } impl<T:to_str> to_str for ~[T] { - fn to_str(&self) -> ~str { - fmt!("[%s]", self.iter().map(|e| e.to_str()).collect::<~[~str]>().connect(", ")) + fn to_string(&self) -> ~str { + fmt!("[%s]", self.iter().map(|e| e.to_string()).collect::<~[~str]>().connect(", ")) } } pub fn main() { - assert!(1.to_str() == ~"1"); - assert!((~[2, 3, 4]).to_str() == ~"[2, 3, 4]"); + assert!(1.to_string() == ~"1"); + assert!((~[2, 3, 4]).to_string() == ~"[2, 3, 4]"); fn indirect<T:to_str>(x: T) -> ~str { - x.to_str() + "!" + x.to_string() + "!" } assert!(indirect(~[10, 20]) == ~"[10, 20]!"); |
