Skip to content

Commit 0e6d895

Browse files
committed
auto merge of #5119 : Kimundi/rust/incoming, r=catamorphism
Removed deprecated `str()` functions in int-template.rs and uint-template.rs
2 parents 565ec93 + 42b0bac commit 0e6d895

File tree

12 files changed

+20
-30
lines changed

12 files changed

+20
-30
lines changed

doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ let mut x = 5;
556556
loop {
557557
x += x - 3;
558558
if x % 5 == 0 { break; }
559-
io::println(int::str(x));
559+
io::println(int::to_str(x));
560560
}
561561
~~~~
562562

src/libcore/num/int-template.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,6 @@ pub pure fn to_str_radix(num: T, radix: uint) -> ~str {
265265
buf
266266
}
267267
268-
/// Convert to a string.
269-
/// *Deprecated*, use to_str() instead.
270-
#[inline(always)]
271-
pub pure fn str(i: T) -> ~str { to_str(i) }
272-
273268
impl ToStr for T {
274269
#[inline(always)]
275270
pure fn to_str(&self) -> ~str {

src/libcore/num/uint-template.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,6 @@ pub pure fn to_str_radix(num: T, radix: uint) -> ~str {
229229
buf
230230
}
231231
232-
/// Convert to a string.
233-
/// *Deprecated*, use to_str() instead.
234-
#[inline(always)]
235-
pub pure fn str(i: T) -> ~str { to_str(i) }
236-
237232
impl ToStr for T {
238233
#[inline(always)]
239234
pure fn to_str(&self) -> ~str {

src/libfuzzer/fuzzer.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub fn check_variants_T<T: Copy>(
290290

291291
if L < 100 {
292292
do under(uint::min(L, 20)) |i| {
293-
log(error, ~"Replacing... #" + uint::str(i));
293+
log(error, ~"Replacing... #" + uint::to_str(i));
294294
let fname = str::from_slice(filename.to_str());
295295
do under(uint::min(L, 30)) |j| {
296296
log(error, ~"With... " + stringifier(@things[j], intr));
@@ -415,7 +415,7 @@ pub fn check_running(exe_filename: &Path) -> happiness {
415415
}
416416
rc => {
417417
failed(~"Rust program ran but exited with status " +
418-
int::str(rc))
418+
int::to_str(rc))
419419
}
420420
}
421421
}

src/librustc/metadata/tyencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ fn enc_sty(w: io::Writer, cx: @ctxt, +st: ty::sty) {
307307
w.write_char('p');
308308
w.write_str((cx.ds)(did));
309309
w.write_char('|');
310-
w.write_str(uint::str(id));
310+
w.write_str(uint::to_str(id));
311311
}
312312
ty::ty_self => {
313313
w.write_char('s');

src/librustc/middle/freevars.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub fn annotate_freevars(def_map: resolve::DefMap, crate: @ast::crate) ->
117117
118118
pub fn get_freevars(tcx: ty::ctxt, fid: ast::node_id) -> freevar_info {
119119
match tcx.freevars.find(&fid) {
120-
None => fail!(~"get_freevars: " + int::str(fid) + ~" has no freevars"),
120+
None => fail!(~"get_freevars: "+int::to_str(fid)+~" has no freevars"),
121121
Some(d) => return d
122122
}
123123
}

src/libstd/time.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ priv fn do_strftime(format: &str, tm: &Tm) -> ~str {
842842
//'U' {}
843843
'u' => {
844844
let i = tm.tm_wday as int;
845-
int::str(if i == 0 { 7 } else { i })
845+
int::to_str(if i == 0 { 7 } else { i })
846846
}
847847
//'V' {}
848848
'v' => {
@@ -852,10 +852,10 @@ priv fn do_strftime(format: &str, tm: &Tm) -> ~str {
852852
parse_type('Y', tm))
853853
}
854854
//'W' {}
855-
'w' => int::str(tm.tm_wday as int),
855+
'w' => int::to_str(tm.tm_wday as int),
856856
//'X' {}
857857
//'x' {}
858-
'Y' => int::str(tm.tm_year as int + 1900),
858+
'Y' => int::to_str(tm.tm_year as int + 1900),
859859
'y' => fmt!("%02d", (tm.tm_year as int + 1900) % 100),
860860
'Z' => copy tm.tm_zone,
861861
'z' => {
@@ -902,15 +902,15 @@ mod tests {
902902
const some_future_date: i64 = 1577836800i64; // 2020-01-01T00:00:00Z
903903

904904
let tv1 = get_time();
905-
log(debug, ~"tv1=" + uint::str(tv1.sec as uint) + ~" sec + "
906-
+ uint::str(tv1.nsec as uint) + ~" nsec");
905+
log(debug, ~"tv1=" + uint::to_str(tv1.sec as uint) + ~" sec + "
906+
+ uint::to_str(tv1.nsec as uint) + ~" nsec");
907907

908908
assert tv1.sec > some_recent_date;
909909
assert tv1.nsec < 1000000000i32;
910910

911911
let tv2 = get_time();
912-
log(debug, ~"tv2=" + uint::str(tv2.sec as uint) + ~" sec + "
913-
+ uint::str(tv2.nsec as uint) + ~" nsec");
912+
log(debug, ~"tv2=" + uint::to_str(tv2.sec as uint) + ~" sec + "
913+
+ uint::to_str(tv2.nsec as uint) + ~" nsec");
914914

915915
assert tv2.sec >= tv1.sec;
916916
assert tv2.sec < some_future_date;
@@ -927,13 +927,13 @@ mod tests {
927927
log(debug, ~"s0=" + float::to_str_digits(s0, 9u) + ~" sec");
928928
assert s0 > 0.;
929929
let ns0 = (s0 * 1000000000.) as u64;
930-
log(debug, ~"ns0=" + u64::str(ns0) + ~" ns");
930+
log(debug, ~"ns0=" + u64::to_str(ns0) + ~" ns");
931931

932-
log(debug, ~"ns1=" + u64::str(ns1) + ~" ns");
932+
log(debug, ~"ns1=" + u64::to_str(ns1) + ~" ns");
933933
assert ns1 >= ns0;
934934

935935
let ns2 = precise_time_ns();
936-
log(debug, ~"ns2=" + u64::str(ns2) + ~" ns");
936+
log(debug, ~"ns2=" + u64::to_str(ns2) + ~" ns");
937937
assert ns2 >= ns1;
938938
}
939939

src/test/bench/shootout-pfib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn main() {
122122
let elapsed = stop - start;
123123

124124
out.write_line(fmt!("%d\t%d\t%s", n, fibn,
125-
u64::str(elapsed)));
125+
u64::to_str(elapsed)));
126126
}
127127
}
128128
}

src/test/run-pass/monad.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<A> option_monad<A> for Option<A> {
3636
}
3737

3838
fn transform(x: Option<int>) -> Option<~str> {
39-
x.bind(|n| Some(*n + 1) ).bind(|n| Some(int::str(*n)) )
39+
x.bind(|n| Some(*n + 1) ).bind(|n| Some(int::to_str(*n)) )
4040
}
4141

4242
pub fn main() {

src/test/run-pass/static-impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ trait uint_utils {
3030
}
3131

3232
impl uint_utils for uint {
33-
fn str() -> ~str { uint::str(self) }
33+
fn str() -> ~str { uint::to_str(self) }
3434
fn multi(f: fn(uint)) {
3535
let mut c = 0u;
3636
while c < self { f(c); c += 1u; }

src/test/run-pass/trait-generic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trait to_str {
1414
fn to_str() -> ~str;
1515
}
1616
impl to_str for int {
17-
fn to_str() -> ~str { int::str(self) }
17+
fn to_str() -> ~str { int::to_str(self) }
1818
}
1919
impl to_str for ~str {
2020
fn to_str() -> ~str { copy self }

src/test/run-pass/trait-to-str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ trait to_str {
2121
}
2222

2323
impl to_str for int {
24-
fn to_str() -> ~str { int::str(self) }
24+
fn to_str() -> ~str { int::to_str(self) }
2525
}
2626

2727
impl<T:to_str> to_str for ~[T] {

0 commit comments

Comments
 (0)