Skip to content

Commit 46fc549

Browse files
committed
rm obsolete integer to_str{,_radix} free functions
1 parent 0d72f60 commit 46fc549

File tree

27 files changed

+104
-152
lines changed

27 files changed

+104
-152
lines changed

doc/rust.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2864,17 +2864,16 @@ the vtable pointer for the `T` implementation of `R`, and the pointer value of `
28642864
An example of an object type:
28652865

28662866
~~~~~~~~
2867-
# use std::int;
28682867
trait Printable {
2869-
fn to_str(&self) -> ~str;
2868+
fn to_string(&self) -> ~str;
28702869
}
28712870
28722871
impl Printable for int {
2873-
fn to_str(&self) -> ~str { int::to_str(*self) }
2872+
fn to_string(&self) -> ~str { self.to_str() }
28742873
}
28752874
28762875
fn print(a: @Printable) {
2877-
println(a.to_str());
2876+
println(a.to_string());
28782877
}
28792878
28802879
fn main() {

doc/tutorial.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,12 +555,11 @@ while cake_amount > 0 {
555555
`loop` denotes an infinite loop, and is the preferred way of writing `while true`:
556556

557557
~~~~
558-
use std::int;
559-
let mut x = 5;
558+
let mut x = 5u;
560559
loop {
561560
x += x - 3;
562561
if x % 5 == 0 { break; }
563-
println(int::to_str(x));
562+
println(x.to_str());
564563
}
565564
~~~~
566565

src/libextra/crypto/digest.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::uint;
1211
use std::vec;
1312

1413

@@ -71,7 +70,7 @@ pub trait Digest {
7170
fn to_hex(rr: &[u8]) -> ~str {
7271
let mut s = ~"";
7372
for b in rr.iter() {
74-
let hex = uint::to_str_radix(*b as uint, 16u);
73+
let hex = (*b as uint).to_str_radix(16u);
7574
if hex.len() == 1 {
7675
s.push_char('0');
7776
}

src/libextra/md4.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111

12-
use std::uint;
1312
use std::vec;
1413

1514
struct Quad {
@@ -121,7 +120,7 @@ pub fn md4_str(msg: &[u8]) -> ~str {
121120
if byte <= 16u8 {
122121
result.push_char('0')
123122
}
124-
result.push_str(uint::to_str_radix(byte as uint, 16u));
123+
result.push_str((byte as uint).to_str_radix(16u));
125124
i += 1u32;
126125
}
127126
}

src/libextra/num/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ impl ToStrRadix for BigUint {
525525
if v.is_empty() { return ~"0" }
526526
let mut s = str::with_capacity(v.len() * l);
527527
for n in v.rev_iter() {
528-
let ss = uint::to_str_radix(*n as uint, radix);
528+
let ss = (*n as uint).to_str_radix(radix);
529529
s.push_str("0".repeat(l - ss.len()));
530530
s.push_str(ss);
531531
}

src/libextra/time.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
#[allow(missing_doc)];
1212

13-
14-
use std::int;
1513
use std::io;
1614
use std::num;
1715
use std::str;
@@ -824,7 +822,7 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str {
824822
//'U' {}
825823
'u' => {
826824
let i = tm.tm_wday as int;
827-
int::to_str(if i == 0 { 7 } else { i })
825+
(if i == 0 { 7 } else { i }).to_str()
828826
}
829827
//'V' {}
830828
'v' => {
@@ -834,10 +832,10 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str {
834832
parse_type('Y', tm))
835833
}
836834
//'W' {}
837-
'w' => int::to_str(tm.tm_wday as int),
835+
'w' => (tm.tm_wday as int).to_str(),
838836
//'X' {}
839837
//'x' {}
840-
'Y' => int::to_str(tm.tm_year as int + 1900),
838+
'Y' => (tm.tm_year as int + 1900).to_str(),
841839
'y' => fmt!("%02d", (tm.tm_year as int + 1900) % 100),
842840
'Z' => tm.tm_zone.clone(),
843841
'z' => {

src/librustc/driver/driver.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use util::common::time;
2626
use util::ppaux;
2727

2828
use std::hashmap::{HashMap,HashSet};
29-
use std::int;
3029
use std::io;
3130
use std::os;
3231
use std::vec;
@@ -454,21 +453,21 @@ pub fn pretty_print_input(sess: Session, cfg: ast::CrateConfig, input: &input,
454453
match node {
455454
pprust::node_item(s, item) => {
456455
pp::space(s.s);
457-
pprust::synth_comment(s, int::to_str(item.id));
456+
pprust::synth_comment(s, item.id.to_str());
458457
}
459458
pprust::node_block(s, ref blk) => {
460459
pp::space(s.s);
461460
pprust::synth_comment(
462-
s, ~"block " + int::to_str(blk.id));
461+
s, ~"block " + blk.id.to_str());
463462
}
464463
pprust::node_expr(s, expr) => {
465464
pp::space(s.s);
466-
pprust::synth_comment(s, int::to_str(expr.id));
465+
pprust::synth_comment(s, expr.id.to_str());
467466
pprust::pclose(s);
468467
}
469468
pprust::node_pat(s, pat) => {
470469
pp::space(s.s);
471-
pprust::synth_comment(s, ~"pat " + int::to_str(pat.id));
470+
pprust::synth_comment(s, ~"pat " + pat.id.to_str());
472471
}
473472
}
474473
}

src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use std::hash::HashUtil;
2525
use std::hashmap::{HashMap, HashSet};
2626
use std::io;
2727
use std::str;
28-
use std::uint;
2928
use std::vec;
3029
use extra::flate;
3130
use extra::serialize::Encodable;
@@ -303,7 +302,7 @@ fn encode_disr_val(_: &EncodeContext,
303302
ebml_w: &mut writer::Encoder,
304303
disr_val: uint) {
305304
ebml_w.start_tag(tag_disr_val);
306-
let s = uint::to_str(disr_val);
305+
let s = disr_val.to_str();
307306
ebml_w.writer.write(s.as_bytes());
308307
ebml_w.end_tag();
309308
}

src/librustc/metadata/tyencode.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use middle::ty;
1717
use std::hashmap::HashMap;
1818
use std::io::WriterUtil;
1919
use std::io;
20-
use std::uint;
2120
use syntax::abi::AbiSet;
2221
use syntax::ast;
2322
use syntax::ast::*;
@@ -324,7 +323,7 @@ fn enc_sty(w: @io::Writer, cx: @ctxt, st: &ty::sty) {
324323
w.write_char('p');
325324
w.write_str((cx.ds)(did));
326325
w.write_char('|');
327-
w.write_str(uint::to_str(id));
326+
w.write_str(id.to_str());
328327
}
329328
ty::ty_self(did) => {
330329
w.write_char('s');

src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ use std::hash;
7171
use std::hashmap::HashMap;
7272
use std::io;
7373
use std::libc::c_uint;
74-
use std::uint;
7574
use std::vec;
7675
use std::local_data;
7776
use extra::time;
@@ -719,7 +718,7 @@ pub fn iter_structural_ty(cx: @mut Block, av: ValueRef, t: ty::t,
719718
for variant in (*variants).iter() {
720719
let variant_cx =
721720
sub_block(cx, ~"enum-iter-variant-" +
722-
uint::to_str(variant.disr_val));
721+
variant.disr_val.to_str());
723722
let variant_cx =
724723
iter_variant(variant_cx, repr, av, *variant,
725724
substs.tps, |x,y,z| f(x,y,z));

0 commit comments

Comments
 (0)