diff options
Diffstat (limited to 'src/test')
44 files changed, 115 insertions, 112 deletions
diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index c3e877f8081..1d2d02d7d59 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -90,11 +90,11 @@ impl Results { let mut set = f(); timed(&mut self.sequential_strings, || { for i in range(0u, num_keys) { - set.insert(i.to_str()); + set.insert(i.to_string()); } for i in range(0u, num_keys) { - assert!(set.contains(&i.to_str())); + assert!(set.contains(&i.to_string())); } }) } @@ -103,7 +103,7 @@ impl Results { let mut set = f(); timed(&mut self.random_strings, || { for _ in range(0, num_keys) { - let s = rng.gen::<uint>().to_str(); + let s = rng.gen::<uint>().to_string(); set.insert(s); } }) @@ -112,11 +112,11 @@ impl Results { { let mut set = f(); for i in range(0u, num_keys) { - set.insert(i.to_str()); + set.insert(i.to_string()); } timed(&mut self.delete_strings, || { for i in range(0u, num_keys) { - assert!(set.remove(&i.to_str())); + assert!(set.remove(&i.to_string())); } }) } diff --git a/src/test/bench/core-uint-to-str.rs b/src/test/bench/core-uint-to-str.rs index 1c51ea055d0..f3851751566 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 = from_str::<uint>(args.get(1).as_slice()).unwrap(); for i in range(0u, n) { - let x = i.to_str(); + let x = i.to_string(); println!("{}", x); } } diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index 8095037662b..0c76d14852e 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -48,7 +48,7 @@ fn show_color_list(set: Vec<Color>) -> String { let mut out = String::new(); for col in set.iter() { out.push_char(' '); - out.push_str(col.to_str().as_slice()); + out.push_str(col.to_string().as_slice()); } out } diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 195c146c12f..b3deb88543e 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -64,7 +64,7 @@ fn sort_and_fmt(mm: &HashMap<Vec<u8> , uint>, total: uint) -> String { k.as_slice() .to_ascii() .to_upper() - .into_str(), v).as_slice()); + .into_string(), v).as_slice()); } return buffer @@ -72,7 +72,7 @@ fn sort_and_fmt(mm: &HashMap<Vec<u8> , uint>, total: uint) -> String { // given a map, search for the frequency of a pattern fn find(mm: &HashMap<Vec<u8> , uint>, key: String) -> uint { - let key = key.to_owned().into_ascii().as_slice().to_lower().into_str(); + let key = key.to_owned().into_ascii().as_slice().to_lower().into_string(); match mm.find_equiv(&key.as_bytes()) { option::None => { return 0u; } option::Some(&num) => { return num; } diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 85f035b60cb..0e0b0b518d5 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -115,7 +115,7 @@ fn main() { let elapsed = stop - start; - println!("{}\t{}\t{}", n, fibn, elapsed.to_str()); + println!("{}\t{}\t{}", n, fibn, elapsed.to_string()); } } } diff --git a/src/test/bench/shootout-regex-dna.rs b/src/test/bench/shootout-regex-dna.rs index 19b9d5638d0..bdf6862d0b1 100644 --- a/src/test/bench/shootout-regex-dna.rs +++ b/src/test/bench/shootout-regex-dna.rs @@ -67,7 +67,7 @@ fn main() { } else { box io::stdin() as Box<io::Reader> }; - let mut seq = rdr.read_to_str().unwrap(); + let mut seq = rdr.read_to_string().unwrap(); let ilen = seq.len(); seq = regex!(">[^\n]*\n|\n").replace_all(seq.as_slice(), NoExpand("")); @@ -109,7 +109,7 @@ fn main() { let (mut variant_strs, mut counts) = (vec!(), vec!()); for variant in variants.move_iter() { let seq_arc_copy = seq_arc.clone(); - variant_strs.push(variant.to_str().to_owned()); + variant_strs.push(variant.to_string().to_owned()); counts.push(Future::spawn(proc() { count_matches(seq_arc_copy.as_slice(), &variant) })); diff --git a/src/test/compile-fail/issue-2063.rs b/src/test/compile-fail/issue-2063.rs index 2c3dda01547..00607f85034 100644 --- a/src/test/compile-fail/issue-2063.rs +++ b/src/test/compile-fail/issue-2063.rs @@ -16,18 +16,18 @@ struct t(Box<t>); //~ ERROR this type cannot be instantiated trait to_str_2 { - fn my_to_str() -> String; + fn my_to_string() -> String; } // I use an impl here because it will cause // the compiler to attempt autoderef and then // try to resolve the method. impl to_str_2 for t { - fn my_to_str() -> String { "t".to_string() } + fn my_to_string() -> String { "t".to_string() } } fn new_t(x: t) { - x.my_to_str(); //~ ERROR does not implement + x.my_to_string(); //~ ERROR does not implement } fn main() { diff --git a/src/test/compile-fail/issue-3973.rs b/src/test/compile-fail/issue-3973.rs index 9b77d62a065..57bc1137912 100644 --- a/src/test/compile-fail/issue-3973.rs +++ b/src/test/compile-fail/issue-3973.rs @@ -13,17 +13,17 @@ struct Point { y: f64, } -trait NewTrait { - fn a(&self) -> String; +trait ToString_ { + fn to_string(&self) -> String; } -impl NewTrait for Point { +impl ToString_ for Point { fn new(x: f64, y: f64) -> Point { - //~^ ERROR method `new` is not a member of trait `NewTrait` + //~^ ERROR method `new` is not a member of trait `ToString_` Point { x: x, y: y } } - fn a(&self) -> String { + fn to_string(&self) -> String { format!("({}, {})", self.x, self.y) } } @@ -32,5 +32,5 @@ fn main() { let p = Point::new(0.0, 0.0); //~^ ERROR unresolved name `Point::new` //~^^ ERROR failed to resolve. Use of undeclared module `Point` - println!("{}", p.a()); + println!("{}", p.to_string()); } diff --git a/src/test/compile-fail/lint-uppercase-variables.rs b/src/test/compile-fail/lint-uppercase-variables.rs index f1b36d719e9..279cf6d94cb 100644 --- a/src/test/compile-fail/lint-uppercase-variables.rs +++ b/src/test/compile-fail/lint-uppercase-variables.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-tidy-linelength + #![allow(dead_code)] #![deny(uppercase_variables)] @@ -30,7 +32,7 @@ fn main() { let mut buff = [0u8, ..16]; match f.read(buff) { Ok(cnt) => println!("read this many bytes: {}", cnt), - Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {}", EndOfFile.to_str()), + Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {}", EndOfFile.to_string()), //~^ ERROR variable names should start with a lowercase character } diff --git a/src/test/compile-fail/moves-based-on-type-block-bad.rs b/src/test/compile-fail/moves-based-on-type-block-bad.rs index 73323def28d..1a2fb33eaab 100644 --- a/src/test/compile-fail/moves-based-on-type-block-bad.rs +++ b/src/test/compile-fail/moves-based-on-type-block-bad.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-tidy-linelength struct S { x: Box<E> @@ -29,7 +30,7 @@ fn main() { f(&s, |hellothere| { match hellothere.x { //~ ERROR cannot move out box Foo(_) => {} - box Bar(x) => println!("{}", x.to_str()), //~ NOTE attempting to move value to here + box Bar(x) => println!("{}", x.to_string()), //~ NOTE attempting to move value to here box Baz => {} } }) diff --git a/src/test/compile-fail/multitrait.rs b/src/test/compile-fail/multitrait.rs index f772b96c697..c7b0bc8822b 100644 --- a/src/test/compile-fail/multitrait.rs +++ b/src/test/compile-fail/multitrait.rs @@ -12,7 +12,7 @@ struct S { y: int } -impl Cmp, ToStr for S { //~ ERROR: expected `{` but found `,` +impl Cmp, ToString for S { //~ ERROR: expected `{` but found `,` fn eq(&&other: S) { false } - fn to_str(&self) -> String { "hi".to_string() } + fn to_string(&self) -> String { "hi".to_string() } } diff --git a/src/test/compile-fail/no-implicit-prelude-nested.rs b/src/test/compile-fail/no-implicit-prelude-nested.rs index 779a1ec7a5b..2fb097f111d 100644 --- a/src/test/compile-fail/no-implicit-prelude-nested.rs +++ b/src/test/compile-fail/no-implicit-prelude-nested.rs @@ -21,7 +21,7 @@ mod foo { impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait - impl ToStr for Test {} //~ ERROR: attempt to implement a nonexistent trait + impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait fn foo() { @@ -33,7 +33,7 @@ mod foo { impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait - impl ToStr for Test {} //~ ERROR: attempt to implement a nonexistent trait + impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait fn foo() { @@ -48,7 +48,7 @@ fn qux() { impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait - impl ToStr for Test {} //~ ERROR: attempt to implement a nonexistent trait + impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait fn foo() { diff --git a/src/test/compile-fail/no-implicit-prelude.rs b/src/test/compile-fail/no-implicit-prelude.rs index fecc597b8fd..c0f7bea25b5 100644 --- a/src/test/compile-fail/no-implicit-prelude.rs +++ b/src/test/compile-fail/no-implicit-prelude.rs @@ -20,7 +20,7 @@ struct Test; impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait -impl ToStr for Test {} //~ ERROR: attempt to implement a nonexistent trait +impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait fn main() { diff --git a/src/test/compile-fail/uninhabited-enum-cast.rs b/src/test/compile-fail/uninhabited-enum-cast.rs index fad20a7e373..9f91337db9f 100644 --- a/src/test/compile-fail/uninhabited-enum-cast.rs +++ b/src/test/compile-fail/uninhabited-enum-cast.rs @@ -11,7 +11,7 @@ enum E {} fn f(e: E) { - println!("{}", (e as int).to_str()); //~ ERROR non-scalar cast + println!("{}", (e as int).to_string()); //~ ERROR non-scalar cast } fn main() {} diff --git a/src/test/compile-fail/use-after-move-implicity-coerced-object.rs b/src/test/compile-fail/use-after-move-implicity-coerced-object.rs index 753c91d1dc9..043f3a233a6 100644 --- a/src/test/compile-fail/use-after-move-implicity-coerced-object.rs +++ b/src/test/compile-fail/use-after-move-implicity-coerced-object.rs @@ -23,10 +23,10 @@ impl fmt::Show for Number { } struct List { - list: Vec<Box<ToStr>> } + list: Vec<Box<ToString>> } impl List { - fn push(&mut self, n: Box<ToStr>) { + fn push(&mut self, n: Box<ToString>) { self.list.push(n); } } @@ -35,6 +35,6 @@ fn main() { let n = box Number { n: 42 }; let mut l = box List { list: Vec::new() }; l.push(n); - let x = n.to_str(); + let x = n.to_string(); //~^ ERROR: use of moved value: `n` } diff --git a/src/test/debuginfo/cross-crate-type-uniquing.rs b/src/test/debuginfo/cross-crate-type-uniquing.rs index 47de06c4856..8f718add2a3 100644 --- a/src/test/debuginfo/cross-crate-type-uniquing.rs +++ b/src/test/debuginfo/cross-crate-type-uniquing.rs @@ -21,4 +21,4 @@ pub fn p() -> C { C } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/bool.rs b/src/test/run-pass/bool.rs index cb364d23387..91075633ab8 100644 --- a/src/test/run-pass/bool.rs +++ b/src/test/run-pass/bool.rs @@ -49,9 +49,9 @@ fn main() { assert_eq!(!true, false); assert_eq!(!false, true); - let s = false.to_str(); + let s = false.to_string(); assert_eq!(s.as_slice(), "false"); - let s = true.to_str(); + let s = true.to_string(); assert_eq!(s.as_slice(), "true"); assert!(true > false); diff --git a/src/test/run-pass/capturing-logging.rs b/src/test/run-pass/capturing-logging.rs index 19186f4b46b..33ee2ffd359 100644 --- a/src/test/run-pass/capturing-logging.rs +++ b/src/test/run-pass/capturing-logging.rs @@ -45,7 +45,7 @@ fn main() { debug!("debug"); info!("info"); }); - let s = r.read_to_str().unwrap(); + let s = r.read_to_string().unwrap(); assert!(s.as_slice().contains("info")); assert!(!s.as_slice().contains("debug")); } diff --git a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs index f3d12d21684..e3dbaa62d35 100644 --- a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs +++ b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs @@ -11,16 +11,16 @@ // aux-build:cci_class_cast.rs extern crate cci_class_cast; -use std::to_str::ToStr; +use std::to_str::ToString; use cci_class_cast::kitty::cat; -fn print_out(thing: Box<ToStr>, expected: String) { - let actual = thing.to_str(); +fn print_out(thing: Box<ToString>, expected: String) { + let actual = thing.to_string(); println!("{}", actual); assert_eq!(actual.to_string(), expected); } pub fn main() { - let nyan: Box<ToStr> = box cat(0u, 2, "nyan".to_string()) as Box<ToStr>; + let nyan: Box<ToString> = box cat(0u, 2, "nyan".to_string()) as Box<ToString>; print_out(nyan, "nyan".to_string()); } diff --git a/src/test/run-pass/class-separate-impl.rs b/src/test/run-pass/class-separate-impl.rs index 3d486144c3e..71438882980 100644 --- a/src/test/run-pass/class-separate-impl.rs +++ b/src/test/run-pass/class-separate-impl.rs @@ -57,13 +57,13 @@ impl fmt::Show for cat { } } -fn print_out(thing: Box<ToStr>, expected: String) { - let actual = thing.to_str(); +fn print_out(thing: Box<ToString>, expected: String) { + let actual = thing.to_string(); println!("{}", actual); assert_eq!(actual.to_string(), expected); } pub fn main() { - let nyan: Box<ToStr> = box cat(0u, 2, "nyan".to_string()) as Box<ToStr>; + let nyan: Box<ToString> = box cat(0u, 2, "nyan".to_string()) as Box<ToString>; print_out(nyan, "nyan".to_string()); } diff --git a/src/test/run-pass/deriving-show-2.rs b/src/test/run-pass/deriving-show-2.rs index a5e86dee18e..fa82e42d793 100644 --- a/src/test/run-pass/deriving-show-2.rs +++ b/src/test/run-pass/deriving-show-2.rs @@ -41,15 +41,15 @@ impl fmt::Show for Custom { } pub fn main() { - assert_eq!(B1.to_str(), "B1".to_string()); - assert_eq!(B2.to_str(), "B2".to_string()); - assert_eq!(C1(3).to_str(), "C1(3)".to_string()); - assert_eq!(C2(B2).to_str(), "C2(B2)".to_string()); - assert_eq!(D1{ a: 2 }.to_str(), "D1 { a: 2 }".to_string()); - assert_eq!(E.to_str(), "E".to_string()); - assert_eq!(F(3).to_str(), "F(3)".to_string()); - assert_eq!(G(3, 4).to_str(), "G(3, 4)".to_string()); - assert_eq!(G(3, 4).to_str(), "G(3, 4)".to_string()); - assert_eq!(I{ a: 2, b: 4 }.to_str(), "I { a: 2, b: 4 }".to_string()); - assert_eq!(J(Custom).to_str(), "J(yay)".to_string()); + assert_eq!(B1.to_string(), "B1".to_string()); + assert_eq!(B2.to_string(), "B2".to_string()); + assert_eq!(C1(3).to_string(), "C1(3)".to_string()); + assert_eq!(C2(B2).to_string(), "C2(B2)".to_string()); + assert_eq!(D1{ a: 2 }.to_string(), "D1 { a: 2 }".to_string()); + assert_eq!(E.to_string(), "E".to_string()); + assert_eq!(F(3).to_string(), "F(3)".to_string()); + assert_eq!(G(3, 4).to_string(), "G(3, 4)".to_string()); + assert_eq!(G(3, 4).to_string(), "G(3, 4)".to_string()); + assert_eq!(I{ a: 2, b: 4 }.to_string(), "I { a: 2, b: 4 }".to_string()); + assert_eq!(J(Custom).to_string(), "J(yay)".to_string()); } diff --git a/src/test/run-pass/exponential-notation.rs b/src/test/run-pass/exponential-notation.rs index bb236638905..7e71be41148 100644 --- a/src/test/run-pass/exponential-notation.rs +++ b/src/test/run-pass/exponential-notation.rs @@ -11,24 +11,24 @@ #![feature(macro_rules)] use s = std::num::strconv; -use to_str = std::num::strconv::float_to_str_common; +use to_string = std::num::strconv::float_to_str_common; macro_rules! t(($a:expr, $b:expr) => { { let (r, _) = $a; assert_eq!(r, $b.to_string()) } }) pub fn main() { // Basic usage - t!(to_str(1.2345678e-5f64, 10u, true, s::SignNeg, s::DigMax(6), s::ExpDec, false), + t!(to_string(1.2345678e-5f64, 10u, true, s::SignNeg, s::DigMax(6), s::ExpDec, false), "1.234568e-5") // Hexadecimal output - t!(to_str(7.281738281250e+01f64, 16u, true, s::SignAll, s::DigMax(6), s::ExpBin, false), + t!(to_string(7.281738281250e+01f64, 16u, true, s::SignAll, s::DigMax(6), s::ExpBin, false), "+1.2345p+6") - t!(to_str(-1.777768135071e-02f64, 16u, true, s::SignAll, s::DigMax(6), s::ExpBin, false), + t!(to_string(-1.777768135071e-02f64, 16u, true, s::SignAll, s::DigMax(6), s::ExpBin, false), "-1.2345p-6") // Some denormals - t!(to_str(4.9406564584124654e-324f64, 10u, true, s::SignNeg, s::DigMax(6), s::ExpBin, false), + t!(to_string(4.9406564584124654e-324f64, 10u, true, s::SignNeg, s::DigMax(6), s::ExpBin, false), "1p-1074") - t!(to_str(2.2250738585072009e-308f64, 10u, true, s::SignNeg, s::DigMax(6), s::ExpBin, false), + t!(to_string(2.2250738585072009e-308f64, 10u, true, s::SignNeg, s::DigMax(6), s::ExpBin, false), "1p-1022") } diff --git a/src/test/run-pass/fixed_length_vec_glue.rs b/src/test/run-pass/fixed_length_vec_glue.rs index 62cfd10dbfb..3b7c5083bb4 100644 --- a/src/test/run-pass/fixed_length_vec_glue.rs +++ b/src/test/run-pass/fixed_length_vec_glue.rs @@ -17,6 +17,6 @@ struct Struc { a: u8, b: [int, ..3], c: int } pub fn main() { let arr = [1,2,3]; let struc = Struc {a: 13u8, b: arr, c: 42}; - let s = repr::repr_to_str(&struc); + let s = repr::repr_to_string(&struc); assert_eq!(s, "Struc{a: 13u8, b: [1, 2, 3], c: 42}".to_string()); } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index d48a944c2f0..4a89d277e9f 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -79,8 +79,8 @@ fn read_board_grid<rdr:'static + io::Reader>(mut input: rdr) mod test { #[test] - pub fn trivial_to_str() { - assert!(lambda.to_str() == "\\") + pub fn trivial_to_string() { + assert!(lambda.to_string() == "\\") } } diff --git a/src/test/run-pass/issue-3037.rs b/src/test/run-pass/issue-3037.rs index 1d442198aec..1555098f291 100644 --- a/src/test/run-pass/issue-3037.rs +++ b/src/test/run-pass/issue-3037.rs @@ -10,7 +10,7 @@ enum what { } -fn what_to_str(x: what) -> String +fn what_to_string(x: what) -> String { match x { } diff --git a/src/test/run-pass/issue-3559.rs b/src/test/run-pass/issue-3559.rs index 53f92246e54..2568d94fcbf 100644 --- a/src/test/run-pass/issue-3559.rs +++ b/src/test/run-pass/issue-3559.rs @@ -24,6 +24,6 @@ pub fn main() { let mut table = HashMap::new(); table.insert("one".to_string(), 1i); table.insert("two".to_string(), 2i); - assert!(check_strs(table.to_str().as_slice(), "{one: 1, two: 2}") || - check_strs(table.to_str().as_slice(), "{two: 2, one: 1}")); + assert!(check_strs(table.to_string().as_slice(), "{one: 1, two: 2}") || + check_strs(table.to_string().as_slice(), "{two: 2, one: 1}")); } diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs index ac022d5c212..e38969c2526 100644 --- a/src/test/run-pass/issue-3563-3.rs +++ b/src/test/run-pass/issue-3563-3.rs @@ -94,7 +94,7 @@ impl AsciiArt { } } -// Allows AsciiArt to be converted to a string using the libcore ToStr trait. +// Allows AsciiArt to be converted to a string using the libcore ToString trait. // Note that the %s fmt! specifier will not call this automatically. impl fmt::Show for AsciiArt { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -159,7 +159,7 @@ pub fn check_strs(actual: &str, expected: &str) -> bool { fn test_ascii_art_ctor() { let art = AsciiArt(3, 3, '*'); - assert!(check_strs(art.to_str().as_slice(), "...\n...\n...")); + assert!(check_strs(art.to_string().as_slice(), "...\n...\n...")); } @@ -168,7 +168,7 @@ fn test_add_pt() { art.add_pt(0, 0); art.add_pt(0, -10); art.add_pt(1, 2); - assert!(check_strs(art.to_str().as_slice(), "*..\n...\n.*.")); + assert!(check_strs(art.to_string().as_slice(), "*..\n...\n.*.")); } @@ -176,7 +176,7 @@ fn test_shapes() { let mut art = AsciiArt(4, 4, '*'); art.add_rect(Rect {top_left: Point {x: 0, y: 0}, size: Size {width: 4, height: 4}}); art.add_point(Point {x: 2, y: 2}); - assert!(check_strs(art.to_str().as_slice(), "****\n*..*\n*.**\n****")); + assert!(check_strs(art.to_string().as_slice(), "****\n*..*\n*.**\n****")); } pub fn main() { diff --git a/src/test/run-pass/issue-3702.rs b/src/test/run-pass/issue-3702.rs index c9cedc3b7de..3f219da0a87 100644 --- a/src/test/run-pass/issue-3702.rs +++ b/src/test/run-pass/issue-3702.rs @@ -11,11 +11,11 @@ pub fn main() { trait Text { - fn to_str(&self) -> String; + fn to_string(&self) -> String; } fn to_string(t: Box<Text>) { - println!("{}", t.to_str()); + println!("{}", t.to_string()); } } diff --git a/src/test/run-pass/issue-4241.rs b/src/test/run-pass/issue-4241.rs index b27720b8579..3ebc3e64573 100644 --- a/src/test/run-pass/issue-4241.rs +++ b/src/test/run-pass/issue-4241.rs @@ -96,19 +96,19 @@ priv fn parse_response(io: @io::Reader) -> Result { } } -priv fn cmd_to_str(cmd: ~[String]) -> String { +priv fn cmd_to_string(cmd: ~[String]) -> String { let mut res = "*".to_string(); - res.push_str(cmd.len().to_str()); + res.push_str(cmd.len().to_string()); res.push_str("\r\n"); for s in cmd.iter() { - res.push_str(["$".to_string(), s.len().to_str(), "\r\n".to_string(), + res.push_str(["$".to_string(), s.len().to_string(), "\r\n".to_string(), (*s).clone(), "\r\n".to_string()].concat() ); } res } fn query(cmd: ~[String], sb: TcpSocketBuf) -> Result { - let cmd = cmd_to_str(cmd); + let cmd = cmd_to_string(cmd); //println!("{}", cmd); sb.write_str(cmd); let res = parse_response(@sb as @io::Reader); @@ -116,7 +116,7 @@ fn query(cmd: ~[String], sb: TcpSocketBuf) -> Result { } fn query2(cmd: ~[String]) -> Result { - let _cmd = cmd_to_str(cmd); + let _cmd = cmd_to_string(cmd); io::with_str_reader("$3\r\nXXX\r\n".to_string())(|sb| { let res = parse_response(@sb as @io::Reader); println!("{:?}", res); diff --git a/src/test/run-pass/issue-5280.rs b/src/test/run-pass/issue-5280.rs index 16fd45a5615..977cd08ba37 100644 --- a/src/test/run-pass/issue-5280.rs +++ b/src/test/run-pass/issue-5280.rs @@ -11,15 +11,15 @@ type FontTableTag = u32; trait FontTableTagConversions { - fn tag_to_str(self); + fn tag_to_string(self); } impl FontTableTagConversions for FontTableTag { - fn tag_to_str(self) { + fn tag_to_string(self) { &self; } } pub fn main() { - 5.tag_to_str(); + 5.tag_to_string(); } diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index 2b67ef09c59..783dc32426a 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -38,7 +38,7 @@ impl<A> option_monad<A> for Option<A> { } fn transform(x: Option<int>) -> Option<String> { - x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_str()) ) + x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_string()) ) } pub fn main() { diff --git a/src/test/run-pass/move-out-of-field.rs b/src/test/run-pass/move-out-of-field.rs index e7d679c41e8..92c5e025b9b 100644 --- a/src/test/run-pass/move-out-of-field.rs +++ b/src/test/run-pass/move-out-of-field.rs @@ -20,7 +20,7 @@ impl StringBuffer { } } -fn to_str(sb: StringBuffer) -> String { +fn to_string(sb: StringBuffer) -> String { sb.s } @@ -30,6 +30,6 @@ pub fn main() { }; sb.append("Hello, "); sb.append("World!"); - let str = to_str(sb); + let str = to_string(sb); assert_eq!(str.as_slice(), "Hello, World!"); } diff --git a/src/test/run-pass/new-impl-syntax.rs b/src/test/run-pass/new-impl-syntax.rs index 9fd6e961675..8532b5f51dc 100644 --- a/src/test/run-pass/new-impl-syntax.rs +++ b/src/test/run-pass/new-impl-syntax.rs @@ -32,6 +32,6 @@ impl<T:fmt::Show> fmt::Show for PolymorphicThingy<T> { } pub fn main() { - println!("{}", Thingy { x: 1, y: 2 }.to_str()); - println!("{}", PolymorphicThingy { x: Thingy { x: 1, y: 2 } }.to_str()); + println!("{}", Thingy { x: 1, y: 2 }.to_string()); + println!("{}", PolymorphicThingy { x: Thingy { x: 1, y: 2 } }.to_string()); } diff --git a/src/test/run-pass/overloaded-deref-count.rs b/src/test/run-pass/overloaded-deref-count.rs index 49edf1bad57..283c76adf0d 100644 --- a/src/test/run-pass/overloaded-deref-count.rs +++ b/src/test/run-pass/overloaded-deref-count.rs @@ -72,7 +72,7 @@ pub fn main() { // N.B. This is required because method lookup hasn't been performed so // we don't know whether the called method takes mutable self, before // the dereference itself is type-checked (a chicken-and-egg problem). - (*n).to_str(); + (*n).to_string(); assert_eq!(n.counts(), (2, 4)); // Mutable deref used for calling a method taking &mut self. diff --git a/src/test/run-pass/send_str_treemap.rs b/src/test/run-pass/send_str_treemap.rs index 68eca8f21a7..f3a730aa2b3 100644 --- a/src/test/run-pass/send_str_treemap.rs +++ b/src/test/run-pass/send_str_treemap.rs @@ -12,7 +12,7 @@ extern crate collections; use std::collections::{ Map, MutableMap}; use std::str::{SendStr, Owned, Slice}; -use std::to_str::ToStr; +use std::to_str::ToString; use self::collections::TreeMap; use std::option::Some; diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index 9267fcac011..d0dacc2ff7a 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -31,7 +31,7 @@ trait uint_utils { impl uint_utils for uint { fn str(&self) -> String { - self.to_str() + self.to_string() } fn multi(&self, f: |uint|) { let mut c = 0u; diff --git a/src/test/run-pass/task-stderr.rs b/src/test/run-pass/task-stderr.rs index 6a71f9df6e4..ceffd1e3636 100644 --- a/src/test/run-pass/task-stderr.rs +++ b/src/test/run-pass/task-stderr.rs @@ -21,6 +21,6 @@ fn main() { }); assert!(res.is_err()); - let output = reader.read_to_str().unwrap(); + let output = reader.read_to_string().unwrap(); assert!(output.as_slice().contains("Hello, world!")); } diff --git a/src/test/run-pass/tcp-connect-timeouts.rs b/src/test/run-pass/tcp-connect-timeouts.rs index ebc720aa0c8..d2408509fc5 100644 --- a/src/test/run-pass/tcp-connect-timeouts.rs +++ b/src/test/run-pass/tcp-connect-timeouts.rs @@ -54,7 +54,7 @@ macro_rules! iotest ( iotest!(fn eventual_timeout() { use native; let addr = next_test_ip4(); - let host = addr.ip.to_str(); + let host = addr.ip.to_string(); let port = addr.port; // Use a native task to receive connections because it turns out libuv is @@ -82,7 +82,7 @@ iotest!(fn eventual_timeout() { iotest!(fn timeout_success() { let addr = next_test_ip4(); - let host = addr.ip.to_str(); + let host = addr.ip.to_string(); let port = addr.port; let _l = TcpListener::bind(host.as_slice(), port).unwrap().listen(); diff --git a/src/test/run-pass/tcp-stress.rs b/src/test/run-pass/tcp-stress.rs index de3366708c5..f52a3455e41 100644 --- a/src/test/run-pass/tcp-stress.rs +++ b/src/test/run-pass/tcp-stress.rs @@ -61,7 +61,7 @@ fn main() { for _ in range(0u, 1000) { let tx = tx.clone(); TaskBuilder::new().stack_size(64 * 1024).spawn(proc() { - let host = addr.ip.to_str(); + let host = addr.ip.to_string(); let port = addr.port; match TcpStream::connect(host.as_slice(), port) { Ok(stream) => { diff --git a/src/test/run-pass/test-ignore-cfg.rs b/src/test/run-pass/test-ignore-cfg.rs index c3387a963a7..b36fbca2da0 100644 --- a/src/test/run-pass/test-ignore-cfg.rs +++ b/src/test/run-pass/test-ignore-cfg.rs @@ -27,10 +27,10 @@ fn checktests() { let tests = __test::TESTS; assert!( - tests.iter().any(|t| t.desc.name.to_str().as_slice() == "shouldignore" && + tests.iter().any(|t| t.desc.name.to_string().as_slice() == "shouldignore" && t.desc.ignore)); assert!( - tests.iter().any(|t| t.desc.name.to_str().as_slice() == "shouldnotignore" && + tests.iter().any(|t| t.desc.name.to_string().as_slice() == "shouldnotignore" && !t.desc.ignore)); } diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs index daab40f5d90..43d3b591ffa 100644 --- a/src/test/run-pass/trait-cast.rs +++ b/src/test/run-pass/trait-cast.rs @@ -39,7 +39,7 @@ impl<T:to_str> to_str for Option<T> { impl to_str for int { fn to_str_(&self) -> String { - self.to_str() + self.to_string() } } diff --git a/src/test/run-pass/trait-generic.rs b/src/test/run-pass/trait-generic.rs index f3f4c556b77..eeda6e2c88b 100644 --- a/src/test/run-pass/trait-generic.rs +++ b/src/test/run-pass/trait-generic.rs @@ -11,16 +11,16 @@ trait to_str { - fn to_string(&self) -> String; + fn to_string_(&self) -> String; } impl to_str for int { - fn to_string(&self) -> String { self.to_str() } + fn to_string_(&self) -> String { self.to_string() } } impl to_str for String { - fn to_string(&self) -> String { self.clone() } + fn to_string_(&self) -> String { self.clone() } } impl to_str for () { - fn to_string(&self) -> String { "()".to_string() } + fn to_string_(&self) -> String { "()".to_string() } } trait map<T> { @@ -40,7 +40,7 @@ fn foo<U, T: map<U>>(x: T) -> Vec<String> { x.map(|_e| "hi".to_string() ) } fn bar<U:to_str,T:map<U>>(x: T) -> Vec<String> { - x.map(|_e| _e.to_string() ) + 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 54a21caafa0..fbe40e837de 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -11,29 +11,29 @@ trait to_str { - fn to_string(&self) -> String; + fn to_string_(&self) -> String; } impl to_str for int { - fn to_string(&self) -> String { self.to_str() } + fn to_string_(&self) -> String { self.to_string() } } impl<T:to_str> to_str for Vec<T> { - fn to_string(&self) -> String { + fn to_string_(&self) -> String { format!("[{}]", self.iter() - .map(|e| e.to_string()) + .map(|e| e.to_string_()) .collect::<Vec<String>>() .connect(", ")) } } pub fn main() { - assert!(1.to_string() == "1".to_string()); - assert!((vec!(2i, 3, 4)).to_string() == "[2, 3, 4]".to_string()); + assert!(1.to_string_() == "1".to_string()); + assert!((vec!(2i, 3, 4)).to_string_() == "[2, 3, 4]".to_string()); fn indirect<T:to_str>(x: T) -> String { - format!("{}!", x.to_string()) + format!("{}!", x.to_string_()) } assert!(indirect(vec!(10i, 20)) == "[10, 20]!".to_string()); diff --git a/src/test/run-pass/vec-to_str.rs b/src/test/run-pass/vec-to_str.rs index 4d9f80cec6a..deb08a4608c 100644 --- a/src/test/run-pass/vec-to_str.rs +++ b/src/test/run-pass/vec-to_str.rs @@ -9,12 +9,12 @@ // except according to those terms. pub fn main() { - assert_eq!((vec!(0i, 1)).to_str(), "[0, 1]".to_string()); - assert_eq!((&[1i, 2]).to_str(), "[1, 2]".to_string()); + assert_eq!((vec!(0i, 1)).to_string(), "[0, 1]".to_string()); + assert_eq!((&[1i, 2]).to_string(), "[1, 2]".to_string()); let foo = vec!(3i, 4); let bar = &[4i, 5]; - assert_eq!(foo.to_str(), "[3, 4]".to_string()); - assert_eq!(bar.to_str(), "[4, 5]".to_string()); + assert_eq!(foo.to_string(), "[3, 4]".to_string()); + assert_eq!(bar.to_string(), "[4, 5]".to_string()); } |
