diff options
| author | Richo Healey <richo@psych0tik.net> | 2014-05-25 03:10:11 -0700 |
|---|---|---|
| committer | Richo Healey <richo@psych0tik.net> | 2014-05-27 11:11:15 -0700 |
| commit | 4348e23b269739657d934b532ad061bfd6d92309 (patch) | |
| tree | 4dece24751feb7145444c52fd05a1c5f7ca2de9d | |
| parent | c7fe4ffe3d8315dfe98bee6d040b5a0381daab91 (diff) | |
| download | rust-4348e23b269739657d934b532ad061bfd6d92309.tar.gz rust-4348e23b269739657d934b532ad061bfd6d92309.zip | |
std: Remove String's to_owned
113 files changed, 442 insertions, 438 deletions
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 8ea718c7f27..a82e574556a 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -314,10 +314,10 @@ pub fn is_test(config: &Config, testfile: &Path) -> bool { // Pretty-printer does not work with .rc files yet let valid_extensions = match config.mode { - Pretty => vec!(".rs".to_owned()), - _ => vec!(".rc".to_owned(), ".rs".to_owned()) + Pretty => vec!(".rs".to_string()), + _ => vec!(".rc".to_string(), ".rs".to_string()) }; - let invalid_prefixes = vec!(".".to_owned(), "#".to_owned(), "~".to_owned()); + let invalid_prefixes = vec!(".".to_string(), "#".to_string(), "~".to_string()); let name = testfile.filename_str().unwrap(); let mut valid = false; diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 7ddbb83155c..f1dd783214a 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -1034,7 +1034,7 @@ fn compose_and_run_compiler( let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths - let extra_link_args = vec!("-L".to_owned(), aux_dir.as_str().unwrap().to_owned()); + let extra_link_args = vec!("-L".to_string(), aux_dir.as_str().unwrap().to_owned()); for rel_ab in props.aux_builds.iter() { let abs_ab = config.aux_base.join(rel_ab.as_slice()); diff --git a/src/doc/rust.md b/src/doc/rust.md index d860c50f0a2..2f002dcfb9a 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -3538,7 +3538,7 @@ allocated on the heap (unlike closures). An example of creating and calling a procedure: ```rust -let string = "Hello".to_owned(); +let string = "Hello".to_string(); // Creates a new procedure, passing it to the `spawn` function. spawn(proc() { diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs index f2059792500..0b5d499c533 100644 --- a/src/libcollections/bitv.rs +++ b/src/libcollections/bitv.rs @@ -988,10 +988,10 @@ mod tests { #[test] fn test_to_str() { let zerolen = Bitv::new(0u, false); - assert_eq!(zerolen.to_str(), "".to_owned()); + assert_eq!(zerolen.to_str(), "".to_string()); let eightbits = Bitv::new(8u, false); - assert_eq!(eightbits.to_str(), "00000000".to_owned()); + assert_eq!(eightbits.to_str(), "00000000".to_string()); } #[test] @@ -1014,7 +1014,7 @@ mod tests { let mut b = bitv::Bitv::new(2, false); b.set(0, true); b.set(1, false); - assert_eq!(b.to_str(), "10".to_owned()); + assert_eq!(b.to_str(), "10".to_string()); } #[test] @@ -1343,7 +1343,7 @@ mod tests { #[test] fn test_from_bools() { assert!(from_bools([true, false, true, true]).to_str() == - "1011".to_owned()); + "1011".to_string()); } #[test] diff --git a/src/libcollections/btree.rs b/src/libcollections/btree.rs index ba83ad8d37c..184a59303f3 100644 --- a/src/libcollections/btree.rs +++ b/src/libcollections/btree.rs @@ -778,70 +778,70 @@ mod test_btree { //Tests the functionality of the insert methods (which are unfinished). #[test] fn insert_test_one() { - let b = BTree::new(1, "abc".to_owned(), 2); - let is_insert = b.insert(2, "xyz".to_owned()); + let b = BTree::new(1, "abc".to_string(), 2); + let is_insert = b.insert(2, "xyz".to_string()); //println!("{}", is_insert.clone().to_str()); assert!(is_insert.root.is_leaf()); } #[test] fn insert_test_two() { - let leaf_elt_1 = LeafElt::new(1, "aaa".to_owned()); - let leaf_elt_2 = LeafElt::new(2, "bbb".to_owned()); - let leaf_elt_3 = LeafElt::new(3, "ccc".to_owned()); + let leaf_elt_1 = LeafElt::new(1, "aaa".to_string()); + let leaf_elt_2 = LeafElt::new(2, "bbb".to_string()); + let leaf_elt_3 = LeafElt::new(3, "ccc".to_string()); let n = Node::new_leaf(vec!(leaf_elt_1, leaf_elt_2, leaf_elt_3)); let b = BTree::new_with_node_len(n, 3, 2); - //println!("{}", b.clone().insert(4, "ddd".to_owned()).to_str()); - assert!(b.insert(4, "ddd".to_owned()).root.is_leaf()); + //println!("{}", b.clone().insert(4, "ddd".to_string()).to_str()); + assert!(b.insert(4, "ddd".to_string()).root.is_leaf()); } #[test] fn insert_test_three() { - let leaf_elt_1 = LeafElt::new(1, "aaa".to_owned()); - let leaf_elt_2 = LeafElt::new(2, "bbb".to_owned()); - let leaf_elt_3 = LeafElt::new(3, "ccc".to_owned()); - let leaf_elt_4 = LeafElt::new(4, "ddd".to_owned()); + let leaf_elt_1 = LeafElt::new(1, "aaa".to_string()); + let leaf_elt_2 = LeafElt::new(2, "bbb".to_string()); + let leaf_elt_3 = LeafElt::new(3, "ccc".to_string()); + let leaf_elt_4 = LeafElt::new(4, "ddd".to_string()); let n = Node::new_leaf(vec!(leaf_elt_1, leaf_elt_2, leaf_elt_3, leaf_elt_4)); let b = BTree::new_with_node_len(n, 3, 2); - //println!("{}", b.clone().insert(5, "eee".to_owned()).to_str()); - assert!(!b.insert(5, "eee".to_owned()).root.is_leaf()); + //println!("{}", b.clone().insert(5, "eee".to_string()).to_str()); + assert!(!b.insert(5, "eee".to_string()).root.is_leaf()); } #[test] fn insert_test_four() { - let leaf_elt_1 = LeafElt::new(1, "aaa".to_owned()); - let leaf_elt_2 = LeafElt::new(2, "bbb".to_owned()); - let leaf_elt_3 = LeafElt::new(3, "ccc".to_owned()); - let leaf_elt_4 = LeafElt::new(4, "ddd".to_owned()); + let leaf_elt_1 = LeafElt::new(1, "aaa".to_string()); + let leaf_elt_2 = LeafElt::new(2, "bbb".to_string()); + let leaf_elt_3 = LeafElt::new(3, "ccc".to_string()); + let leaf_elt_4 = LeafElt::new(4, "ddd".to_string()); let n = Node::new_leaf(vec!(leaf_elt_1, leaf_elt_2, leaf_elt_3, leaf_elt_4)); let mut b = BTree::new_with_node_len(n, 3, 2); - b = b.clone().insert(5, "eee".to_owned()); - b = b.clone().insert(6, "fff".to_owned()); - b = b.clone().insert(7, "ggg".to_owned()); - b = b.clone().insert(8, "hhh".to_owned()); - b = b.clone().insert(0, "omg".to_owned()); + b = b.clone().insert(5, "eee".to_string()); + b = b.clone().insert(6, "fff".to_string()); + b = b.clone().insert(7, "ggg".to_string()); + b = b.clone().insert(8, "hhh".to_string()); + b = b.clone().insert(0, "omg".to_string()); //println!("{}", b.clone().to_str()); assert!(!b.root.is_leaf()); } #[test] fn bsearch_test_one() { - let b = BTree::new(1, "abc".to_owned(), 2); + let b = BTree::new(1, "abc".to_string(), 2); assert_eq!(Some(1), b.root.bsearch_node(2)); } #[test] fn bsearch_test_two() { - let b = BTree::new(1, "abc".to_owned(), 2); + let b = BTree::new(1, "abc".to_string(), 2); assert_eq!(Some(0), b.root.bsearch_node(0)); } #[test] fn bsearch_test_three() { - let leaf_elt_1 = LeafElt::new(1, "aaa".to_owned()); - let leaf_elt_2 = LeafElt::new(2, "bbb".to_owned()); - let leaf_elt_3 = LeafElt::new(4, "ccc".to_owned()); - let leaf_elt_4 = LeafElt::new(5, "ddd".to_owned()); + let leaf_elt_1 = LeafElt::new(1, "aaa".to_string()); + let leaf_elt_2 = LeafElt::new(2, "bbb".to_string()); + let leaf_elt_3 = LeafElt::new(4, "ccc".to_string()); + let leaf_elt_4 = LeafElt::new(5, "ddd".to_string()); let n = Node::new_leaf(vec!(leaf_elt_1, leaf_elt_2, leaf_elt_3, leaf_elt_4)); let b = BTree::new_with_node_len(n, 3, 2); assert_eq!(Some(2), b.root.bsearch_node(3)); @@ -849,10 +849,10 @@ mod test_btree { #[test] fn bsearch_test_four() { - let leaf_elt_1 = LeafElt::new(1, "aaa".to_owned()); - let leaf_elt_2 = LeafElt::new(2, "bbb".to_owned()); - let leaf_elt_3 = LeafElt::new(4, "ccc".to_owned()); - let leaf_elt_4 = LeafElt::new(5, "ddd".to_owned()); + let leaf_elt_1 = LeafElt::new(1, "aaa".to_string()); + let leaf_elt_2 = LeafElt::new(2, "bbb".to_string()); + let leaf_elt_3 = LeafElt::new(4, "ccc".to_string()); + let leaf_elt_4 = LeafElt::new(5, "ddd".to_string()); let n = Node::new_leaf(vec!(leaf_elt_1, leaf_elt_2, leaf_elt_3, leaf_elt_4)); let b = BTree::new_with_node_len(n, 3, 2); assert_eq!(Some(4), b.root.bsearch_node(800)); @@ -861,15 +861,15 @@ mod test_btree { //Tests the functionality of the get method. #[test] fn get_test() { - let b = BTree::new(1, "abc".to_owned(), 2); + let b = BTree::new(1, "abc".to_string(), 2); let val = b.get(1); - assert_eq!(val, Some("abc".to_owned())); + assert_eq!(val, Some("abc".to_string())); } //Tests the BTree's clone() method. #[test] fn btree_clone_test() { - let b = BTree::new(1, "abc".to_owned(), 2); + let b = BTree::new(1, "abc".to_string(), 2); let b2 = b.clone(); assert!(b.root == b2.root) } @@ -877,32 +877,32 @@ mod test_btree { //Tests the BTree's cmp() method when one node is "less than" another. #[test] fn btree_cmp_test_less() { - let b = BTree::new(1, "abc".to_owned(), 2); - let b2 = BTree::new(2, "bcd".to_owned(), 2); + let b = BTree::new(1, "abc".to_string(), 2); + let b2 = BTree::new(2, "bcd".to_string(), 2); assert!(&b.cmp(&b2) == &Less) } //Tests the BTree's cmp() method when two nodes are equal. #[test] fn btree_cmp_test_eq() { - let b = BTree::new(1, "abc".to_owned(), 2); - let b2 = BTree::new(1, "bcd".to_owned(), 2); + let b = BTree::new(1, "abc".to_string(), 2); + let b2 = BTree::new(1, "bcd".to_string(), 2); assert!(&b.cmp(&b2) == &Equal) } //Tests the BTree's cmp() method when one node is "greater than" another. #[test] fn btree_cmp_test_greater() { - let b = BTree::new(1, "abc".to_owned(), 2); - let b2 = BTree::new(2, "bcd".to_owned(), 2); + let b = BTree::new(1, "abc".to_string(), 2); + let b2 = BTree::new(2, "bcd".to_string(), 2); assert!(&b2.cmp(&b) == &Greater) } //Tests the BTree's to_str() method. #[test] fn btree_tostr_test() { - let b = BTree::new(1, "abc".to_owned(), 2); - assert_eq!(b.to_str(), "Key: 1, value: abc;".to_owned()) + let b = BTree::new(1, "abc".to_string(), 2); + assert_eq!(b.to_str(), "Key: 1, value: abc;".to_string()) } } diff --git a/src/libcollections/hashmap.rs b/src/libcollections/hashmap.rs index 1b79b84ff90..0fe1cb6ee72 100644 --- a/src/libcollections/hashmap.rs +++ b/src/libcollections/hashmap.rs @@ -2026,9 +2026,9 @@ mod test_map { let mut m = HashMap::new(); let (foo, bar, baz) = (1,2,3); - m.insert("foo".to_owned(), foo); - m.insert("bar".to_owned(), bar); - m.insert("baz".to_owned(), baz); + m.insert("foo".to_string(), foo); + m.insert("bar".to_string(), bar); + m.insert("baz".to_string(), baz); assert_eq!(m.find_equiv(&("foo")), Some(&foo)); @@ -2313,8 +2313,8 @@ mod test_set { let set_str = format!("{}", set); - assert!(set_str == "{1, 2}".to_owned() || set_str == "{2, 1}".to_owned()); - assert_eq!(format!("{}", empty), "{}".to_owned()); + assert!(set_str == "{1, 2}".to_string() || set_str == "{2, 1}".to_string()); + assert_eq!(format!("{}", empty), "{}".to_string()); } } diff --git a/src/libcollections/lru_cache.rs b/src/libcollections/lru_cache.rs index 91b725178f3..f4a6cdaa712 100644 --- a/src/libcollections/lru_cache.rs +++ b/src/libcollections/lru_cache.rs @@ -319,15 +319,15 @@ mod tests { cache.put(1, 10); cache.put(2, 20); cache.put(3, 30); - assert_eq!(cache.to_str(), "{3: 30, 2: 20, 1: 10}".to_owned()); + assert_eq!(cache.to_str(), "{3: 30, 2: 20, 1: 10}".to_string()); cache.put(2, 22); - assert_eq!(cache.to_str(), "{2: 22, 3: 30, 1: 10}".to_owned()); + assert_eq!(cache.to_str(), "{2: 22, 3: 30, 1: 10}".to_string()); cache.put(6, 60); - assert_eq!(cache.to_str(), "{6: 60, 2: 22, 3: 30}".to_owned()); + assert_eq!(cache.to_str(), "{6: 60, 2: 22, 3: 30}".to_string()); cache.get(&3); - assert_eq!(cache.to_str(), "{3: 30, 6: 60, 2: 22}".to_owned()); + assert_eq!(cache.to_str(), "{3: 30, 6: 60, 2: 22}".to_string()); cache.change_capacity(2); - assert_eq!(cache.to_str(), "{3: 30, 6: 60}".to_owned()); + assert_eq!(cache.to_str(), "{3: 30, 6: 60}".to_string()); } #[test] @@ -338,6 +338,6 @@ mod tests { cache.clear(); assert!(cache.get(&1).is_none()); assert!(cache.get(&2).is_none()); - assert_eq!(cache.to_str(), "{}".to_owned()); + assert_eq!(cache.to_str(), "{}".to_string()); } } diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index 75f67c3df65..731911185ff 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -140,7 +140,7 @@ pub struct RadixFmt<T, R>(T, R); /// /// ~~~ /// use std::fmt::radix; -/// assert_eq!(format!("{}", radix(55, 36)), "1j".to_owned()); +/// assert_eq!(format!("{}", radix(55, 36)), "1j".to_string()); /// ~~~ pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> { RadixFmt(x, Radix::new(base)) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index dcec07ef24e..6135f4dcca4 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -552,7 +552,7 @@ mod tests { #[test] fn test_replace() { - let mut x = Some("test".to_owned()); + let mut x = Some("test".to_string()); let y = replace(&mut x, None); assert!(x.is_none()); assert!(y.is_some()); @@ -576,7 +576,7 @@ mod tests { } unsafe { - assert!(Vec::from_slice([76u8]) == transmute("L".to_owned())); + assert!(Vec::from_slice([76u8]) == transmute("L".to_string())); } } } diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 3979a1ad8c8..31313050165 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -925,15 +925,15 @@ pub trait MutableVector<'a, T> { /// # Example /// /// ```rust - /// let mut v = ~["foo".to_owned(), "bar".to_owned(), "baz".to_owned()]; + /// let mut v = ~["foo".to_string(), "bar".to_string(), "baz".to_string()]; /// /// unsafe { - /// // `"baz".to_owned()` is deallocated. - /// v.unsafe_set(2, "qux".to_owned()); + /// // `"baz".to_string()` is deallocated. + /// v.unsafe_set(2, "qux".to_string()); /// /// // Out of bounds: could cause a crash, or overwriting /// // other data, or something else. - /// // v.unsafe_set(10, "oops".to_owned()); + /// // v.unsafe_set(10, "oops".to_string()); /// } /// ``` unsafe fn unsafe_set(self, index: uint, val: T); @@ -945,10 +945,10 @@ pub trait MutableVector<'a, T> { /// # Example /// /// ```rust - /// let mut v = ["foo".to_owned(), "bar".to_owned()]; + /// let mut v = ["foo".to_string(), "bar".to_string()]; /// - /// // memory leak! `"bar".to_owned()` is not deallocated. - /// unsafe { v.init_elem(1, "baz".to_owned()); } + /// // memory leak! `"bar".to_string()` is not deallocated. + /// unsafe { v.init_elem(1, "baz".to_string()); } /// ``` unsafe fn init_elem(self, i: uint, val: T); diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 85e1a7decc2..0738462b826 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -728,7 +728,7 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String { each_split_within(desc_normalized_whitespace.as_slice(), 54, |substr| { - desc_rows.push(substr.to_owned()); + desc_rows.push(substr.to_string()); true }); diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs index d1711c1b890..177b90f2e1a 100644 --- a/src/libnative/io/process.rs +++ b/src/libnative/io/process.rs @@ -1103,24 +1103,24 @@ mod tests { assert_eq!( test_wrapper("prog", ["aaa", "bbb", "ccc"]), - "prog aaa bbb ccc".to_owned() + "prog aaa bbb ccc".to_string() ); assert_eq!( test_wrapper("C:\\Program Files\\blah\\blah.exe", ["aaa"]), - "\"C:\\Program Files\\blah\\blah.exe\" aaa".to_owned() + "\"C:\\Program Files\\blah\\blah.exe\" aaa".to_string() ); assert_eq!( test_wrapper("C:\\Program Files\\test", ["aa\"bb"]), - "\"C:\\Program Files\\test\" aa\\\"bb".to_owned() + "\"C:\\Program Files\\test\" aa\\\"bb".to_string() ); assert_eq!( test_wrapper("echo", ["a b c"]), - "echo \"a b c\"".to_owned() + "echo \"a b c\"".to_string() ); assert_eq!( test_wrapper("\u03c0\u042f\u97f3\u00e6\u221e", []), - "\u03c0\u042f\u97f3\u00e6\u221e".to_owned() + "\u03c0\u042f\u97f3\u00e6\u221e".to_string() ); } } diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 89a79dbb80d..0b1efd3cfbb 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -703,7 +703,7 @@ pub fn exported_name(path: PathElems, hash: &str, vers: &str) -> String { let vers = if vers.len() > 0 && !char::is_XID_start(vers.char_at(0)) { format!("v{}", vers) } else { - vers.to_owned() + vers.to_string() }; mangle(path, Some(hash), Some(vers.as_slice())) diff --git a/src/librustc/driver/mod.rs b/src/librustc/driver/mod.rs index e764b07a828..998a88bcea9 100644 --- a/src/librustc/driver/mod.rs +++ b/src/librustc/driver/mod.rs @@ -399,10 +399,10 @@ fn monitor(f: proc():Send) { } let xs = [ - "the compiler hit an unexpected failure path. this is a bug.".to_owned(), + "the compiler hit an unexpected failure path. this is a bug.".to_string(), format!("we would appreciate a bug report: {}", BUG_REPORT_URL), - "run with `RUST_BACKTRACE=1` for a backtrace".to_owned(), + "run with `RUST_BACKTRACE=1` for a backtrace".to_string(), ]; for note in xs.iter() { emitter.emit(None, note.as_slice(), diagnostic::Note) diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 6c924704043..9fd1fb67450 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -451,7 +451,7 @@ fn parse_fn_style(c: char) -> FnStyle { fn parse_abi_set(st: &mut PState) -> abi::Abi { assert_eq!(next(st), '['); scan(st, |c| c == ']', |bytes| { - let abi_str = str::from_utf8(bytes).unwrap().to_owned(); + let abi_str = str::from_utf8(bytes).unwrap().to_string(); abi::lookup(abi_str.as_slice()).expect(abi_str) }) } diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index d3437e60658..946d2b4a969 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -5540,18 +5540,18 @@ impl<'a> Resolver<'a> { for (&name, import_resolution) in import_resolutions.iter() { let value_repr; match import_resolution.target_for_namespace(ValueNS) { - None => { value_repr = "".to_owned(); } + None => { value_repr = "".to_string(); } Some(_) => { - value_repr = " value:?".to_owned(); + value_repr = " value:?".to_string(); // FIXME #4954 } } let type_repr; match import_resolution.target_for_namespace(TypeNS) { - None => { type_repr = "".to_owned(); } + None => { type_repr = "".to_string(); } Some(_) => { - type_repr = " type:?".to_owned(); + type_repr = " type:?".to_string(); // FIXME #4954 } } diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 655910d98a4..ee0a802de3f 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -1106,9 +1106,9 @@ pub fn new_fn_ctxt<'a>(ccx: &'a CrateContext, debug!("new_fn_ctxt(path={}, id={}, param_substs={})", if id == -1 { - "".to_owned() + "".to_string() } else { - ccx.tcx.map.path_to_str(id).to_owned() + ccx.tcx.map.path_to_str(id).to_string() }, id, param_substs.map(|s| s.repr(ccx.tcx()))); diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 3e3576e6f80..94f17172d58 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -1146,28 +1146,28 @@ fn basic_type_metadata(cx: &CrateContext, t: ty::t) -> DIType { debug!("basic_type_metadata: {:?}", ty::get(t)); let (name, encoding) = match ty::get(t).sty { - ty::ty_nil => ("()".to_owned(), DW_ATE_unsigned), - ty::ty_bot => ("!".to_owned(), DW_ATE_unsigned), - ty::ty_bool => ("bool".to_owned(), DW_ATE_boolean), - ty::ty_char => ("char".to_owned(), DW_ATE_unsigned_char), + ty::ty_nil => ("()".to_string(), DW_ATE_unsigned), + ty::ty_bot => ("!".to_string(), DW_ATE_unsigned), + ty::ty_bool => ("bool".to_string(), DW_ATE_boolean), + ty::ty_char => ("char".to_string(), DW_ATE_unsigned_char), ty::ty_int(int_ty) => match int_ty { - ast::TyI => ("int".to_owned(), DW_ATE_signed), - ast::TyI8 => ("i8".to_owned(), DW_ATE_signed), - ast::TyI16 => ("i16".to_owned(), DW_ATE_signed), - ast::TyI32 => ("i32".to_owned(), DW_ATE_signed), - ast::TyI64 => ("i64".to_owned(), DW_ATE_signed) + ast::TyI => ("int".to_string(), DW_ATE_signed), + ast::TyI8 => ("i8".to_string(), DW_ATE_signed), + ast::TyI16 => ("i16".to_string(), DW_ATE_signed), + ast::TyI32 => ("i32".to_string(), DW_ATE_signed), + ast::TyI64 => ("i64".to_string(), DW_ATE_signed) }, ty::ty_uint(uint_ty) => match uint_ty { - ast::TyU => ("uint".to_owned(), DW_ATE_unsigned), - ast::TyU8 => ("u8".to_owned(), DW_ATE_unsigned), - ast::TyU16 => ("u16".to_owned(), DW_ATE_unsigned), - ast::TyU32 => ("u32".to_owned(), DW_ATE_unsigned), - ast::TyU64 => ("u64".to_owned(), DW_ATE_unsigned) + ast::TyU => ("uint".to_string(), DW_ATE_unsigned), + ast::TyU8 => ("u8".to_string(), DW_ATE_unsigned), + ast::TyU16 => ("u16".to_string(), DW_ATE_unsigned), + ast::TyU32 => ("u32".to_string(), DW_ATE_unsigned), + ast::TyU64 => ("u64".to_string(), DW_ATE_unsigned) }, ty::ty_float(float_ty) => match float_ty { - ast::TyF32 => ("f32".to_owned(), DW_ATE_float), - ast::TyF64 => ("f64".to_owned(), DW_ATE_float), - ast::TyF128 => ("f128".to_owned(), DW_ATE_float) + ast::TyF32 => ("f32".to_string(), DW_ATE_float), + ast::TyF64 => ("f64".to_string(), DW_ATE_float), + ast::TyF128 => ("f128".to_string(), DW_ATE_float) }, _ => cx.sess().bug("debuginfo::basic_type_metadata - t is invalid type") }; diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs index f5f3d4366f6..4b81463ed79 100644 --- a/src/librustc/middle/trans/reflect.rs +++ b/src/librustc/middle/trans/reflect.rs @@ -190,7 +190,7 @@ impl<'a, 'b> Reflector<'a, 'b> { ty::ty_rptr(_, ref mt) => { match ty::get(mt.ty).sty { ty::ty_vec(ref mt, None) => { - let (name, extra) = ("slice".to_owned(), Vec::new()); + let (name, extra) = ("slice".to_string(), Vec::new()); let extra = extra.append(self.c_mt(mt).as_slice()); self.visit(format!("evec_{}", name).as_slice(), extra.as_slice()) diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index 36500cc27f8..4421c84e86f 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -228,7 +228,7 @@ pub fn trans_uniq_vstore<'a>(bcx: &'a Block<'a>, content_expr: &ast::Expr) -> DatumBlock<'a, Expr> { /*! - * ~[...] and "...".to_owned() allocate boxes in the exchange heap and write + * ~[...] and "...".to_string() allocate boxes in the exchange heap and write * the array elements into them. */ @@ -236,7 +236,7 @@ pub fn trans_uniq_vstore<'a>(bcx: &'a Block<'a>, let fcx = bcx.fcx; let ccx = fcx.ccx; - // Handle "".to_owned(). + // Handle "".to_string(). match content_expr.node { ast::ExprLit(lit) => { match lit.node { diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index bb6b0c51a27..d287abfcda1 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -2707,7 +2707,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt, let error = if vst == ast::ExprVstoreSlice { "`&\"string\"` has been removed; use `\"string\"` instead" } else { - "`~\"string\"` has been removed; use `\"string\".to_owned()` instead" + "`~\"string\"` has been removed; use `\"string\".to_string()` instead" }; tcx.sess.span_err(expr.span, error); ty::mk_err() diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs index 6b4da020506..1cbee01db28 100644 --- a/src/librustc/middle/typeck/infer/error_reporting.rs +++ b/src/librustc/middle/typeck/infer/error_reporting.rs @@ -808,7 +808,7 @@ impl<'a> Rebuilder<'a> { // choice of lifetime name deterministic and thus easier to test. let mut names = Vec::new(); for rn in region_names.iter() { - let lt_name = token::get_name(*rn).get().to_owned(); + let lt_name = token::get_name(*rn).get().to_string(); names.push(lt_name); } names.sort(); diff --git a/src/librustc/middle/typeck/infer/test.rs b/src/librustc/middle/typeck/infer/test.rs index 231d84f37c5..e4636e1c7c6 100644 --- a/src/librustc/middle/typeck/infer/test.rs +++ b/src/librustc/middle/typeck/infer/test.rs @@ -46,11 +46,11 @@ static EMPTY_SOURCE_STR: &str = "/* Hello, world! */"; fn setup_env(test_name: &str, source_string: &str) -> Env { let messages = @DVec(); - let matches = getopts(vec!("-Z".to_owned(), "verbose".to_owned()), optgroups()).get(); + let matches = getopts(vec!("-Z".to_string(), "verbose".to_string()), optgroups()).get(); let diag = diagnostic::collect(messages); - let sessopts = build_session_options("rustc".to_owned(), &matches, diag); + let sessopts = build_session_options("rustc".to_string(), &matches, diag); let sess = build_session(sessopts, None, diag); - let cfg = build_configuration(sess, "whatever".to_owned(), str_input("".to_owned())); + let cfg = build_configuration(sess, "whatever".to_string(), str_input("".to_string())); let dm = HashMap(); let amap = HashMap(); let freevars = HashMap(); diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 9043ffd10ba..625ee8f418c 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -198,7 +198,7 @@ fn path(w: &mut fmt::Formatter, path: &clean::Path, print_all: bool, let cache = cache_key.get().unwrap(); let abs_root = root(&**cache, loc.as_slice()); let rel_root = match path.segments.get(0).name.as_slice() { - "self" => Some("./".to_owned()), + "self" => Some("./".to_string()), _ => None, }; diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index f49b7f3e989..80caad84863 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -197,7 +197,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result { // Extract the text provided let s = if text.is_null() { - "".to_owned() + "".to_string() } else { unsafe { str::raw::from_buf_len((*text).data, (*text).size as uint) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index d601d2ae957..ecbda89ee61 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -378,7 +378,7 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> { try!(write!(&mut w, r"]\};")); - str::from_utf8(w.unwrap().as_slice()).unwrap().to_owned() + str::from_utf8(w.unwrap().as_slice()).unwrap().to_string() }; // Write out the shared files. Note that these are shared among all rustdoc @@ -1057,7 +1057,7 @@ impl<'a> Item<'a> { if ast_util::is_local(self.item.def_id) { let mut path = Vec::new(); clean_srcpath(self.item.source.filename.as_bytes(), |component| { - path.push(component.to_owned()); + path.push(component.to_string()); }); let href = if self.item.source.loline == self.item.source.hiline { format!("{}", self.item.source.loline) @@ -1087,7 +1087,7 @@ impl<'a> Item<'a> { let cache = cache_key.get().unwrap(); let path = cache.external_paths.get(&self.item.def_id); let root = match *cache.extern_locations.get(&self.item.def_id.krate) { - Remote(ref s) => s.to_strbuf(), + Remote(ref s) => s.to_string(), Local => format!("{}/..", self.cx.root_path), Unknown => return None, }; diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs index 390f81642e6..ea58f1f3fc6 100644 --- a/src/librustdoc/passes.rs +++ b/src/librustdoc/passes.rs @@ -346,14 +346,14 @@ mod unindent_tests { #[test] fn should_unindent() { - let s = " line1\n line2".to_owned(); + let s = " line1\n line2".to_string(); let r = unindent(s.as_slice()); assert_eq!(r.as_slice(), "line1\nline2"); } #[test] fn should_unindent_multiple_paragraphs() { - let s = " line1\n\n line2".to_owned(); + let s = " line1\n\n line2".to_string(); let r = unindent(s.as_slice()); assert_eq!(r.as_slice(), "line1\n\nline2"); } @@ -362,7 +362,7 @@ mod unindent_tests { fn should_leave_multiple_indent_levels() { // Line 2 is indented another level beyond the // base indentation and should be preserved - let s = " line1\n\n line2".to_owned(); + let s = " line1\n\n line2".to_string(); let r = unindent(s.as_slice()); assert_eq!(r.as_slice(), "line1\n\n line2"); } @@ -374,14 +374,14 @@ mod unindent_tests { // // #[doc = "Start way over here // and continue here"] - let s = "line1\n line2".to_owned(); + let s = "line1\n line2".to_string(); let r = unindent(s.as_slice()); assert_eq!(r.as_slice(), "line1\nline2"); } #[test] fn should_not_ignore_first_line_indent_in_a_single_line_para() { - let s = "line1\n\n line2".to_owned(); + let s = "line1\n\n line2".to_string(); let r = unindent(s.as_slice()); assert_eq!(r.as_slice(), "line1\n\n line2"); } diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 40244a67a4a..b24e1f238b7 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -179,8 +179,8 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, should_fail: bool, // Add the new dylib search path var let newpath = DynamicLibrary::create_path(path.as_slice()); - env.push((var.to_owned(), - str::from_utf8(newpath.as_slice()).unwrap().to_owned())); + env.push((var.to_string(), + str::from_utf8(newpath.as_slice()).unwrap().to_string())); env }; match Command::new(exe).env(env.as_slice()).output() { @@ -265,7 +265,7 @@ impl Collector { }; self.cnt += 1; let libs = self.libs.clone(); - let cratename = self.cratename.to_owned(); + let cratename = self.cratename.to_string(); let loose_feature_gating = self.loose_feature_gating; debug!("Creating test {}: {}", name, test); self.tests.push(testing::TestDescAndFn { diff --git a/src/libsemver/lib.rs b/src/libsemver/lib.rs index 342a79057af..fea473f35b4 100644 --- a/src/libsemver/lib.rs +++ b/src/libsemver/lib.rs @@ -389,10 +389,10 @@ fn test_show() { #[test] fn test_to_str() { - assert_eq!(parse("1.2.3").unwrap().to_str(), "1.2.3".to_owned()); - assert_eq!(parse("1.2.3-alpha1").unwrap().to_str(), "1.2.3-alpha1".to_owned()); - assert_eq!(parse("1.2.3+build.42").unwrap().to_str(), "1.2.3+build.42".to_owned()); - assert_eq!(parse("1.2.3-alpha1+42").unwrap().to_str(), "1.2.3-alpha1+42".to_owned()); + assert_eq!(parse("1.2.3").unwrap().to_str(), "1.2.3".to_string()); + assert_eq!(parse("1.2.3-alpha1").unwrap().to_str(), "1.2.3-alpha1".to_string()); + assert_eq!(parse("1.2.3+build.42").unwrap().to_str(), "1.2.3+build.42".to_string()); + assert_eq!(parse("1.2.3-alpha1+42").unwrap().to_str(), "1.2.3-alpha1+42".to_string()); } #[test] diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index 029f7162b42..983d76a0844 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -669,7 +669,7 @@ mod tests { #[test] fn test_clone_noleak() { fn foo(f: |c: &CString|) { - let s = "test".to_owned(); + let s = "test".to_string(); let c = s.to_c_str(); // give the closure a non-owned CString let mut c_ = c.with_ref(|c| unsafe { CString::new(c, false) } ); diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs index 0952652498a..174ea00d286 100644 --- a/src/libstd/fmt.rs +++ b/src/libstd/fmt.rs @@ -34,12 +34,12 @@ format arguments directly while performing minimal allocations. Some examples of the `format!` extension are: ```rust -format!("Hello"); // => "Hello".to_owned() -format!("Hello, {:s}!", "world"); // => "Hello, world!".to_owned() -format!("The number is {:d}", 1); // => "The number is 1".to_owned() -format!("{:?}", ~[3, 4]); // => "~[3, 4]".to_owned() -format!("{value}", value=4); // => "4".to_owned() -format!("{} {}", 1, 2); // => "1 2".to_owned() +format!("Hello"); // => "Hello".to_string() +format!("Hello, {:s}!", "world"); // => "Hello, world!".to_string() +format!("The number is {:d}", 1); // => "The number is 1".to_string() +format!("{:?}", ~[3, 4]); // => "~[3, 4]".to_string() +format!("{value}", value=4); // => "4".to_string() +format!("{} {}", 1, 2); // => "1 2".to_string() ``` From these, you can see that the first argument is a format string. It is @@ -62,7 +62,7 @@ iterator over the argument. Each time a "next argument" specifier is seen, the iterator advances. This leads to behavior like this: ```rust -format!("{1} {} {0} {}", 1, 2); // => "2 1 1 2".to_owned() +format!("{1} {} {0} {}", 1, 2); // => "2 1 1 2".to_string() ``` The internal iterator over the argument has not been advanced by the time the @@ -89,9 +89,9 @@ identifier '=' expression For example, the following `format!` expressions all use named argument: ```rust -format!("{argument}", argument = "test"); // => "test".to_owned() -format!("{name} {}", 1, name = 2); // => "2 1".to_owned() -format!("{a:s} {c:d} {b:?}", a="a", b=(), c=3); // => "a 3 ()".to_owned() +format!("{argument}", argument = "test"); // => "test".to_string() +format!("{name} {}", 1, name = 2); // => "2 1".to_string() +format!("{a:s} {c:d} {b:?}", a="a", b=(), c=3); // => "a 3 ()".to_string() ``` It is illegal to put positional parameters (those without names) after arguments @@ -330,7 +330,7 @@ to reference the string value of the argument which was selected upon. As an example: ```rust -format!("{0, select, other{#}}", "hello"); // => "hello".to_owned() +format!("{0, select, other{#}}", "hello"); // => "hello".to_string() ``` This example is the equivalent of `{0:s}` essentially. @@ -543,7 +543,7 @@ pub trait Poly { /// use std::fmt; /// /// let s = format_args!(fmt::format, "Hello, {}!", "world"); -/// assert_eq!(s, "Hello, world!".to_owned()); +/// assert_eq!(s, "Hello, world!".to_string()); /// ``` pub fn format(args: &Arguments) -> string::String{ let mut output = io::MemWriter::new(); diff --git a/src/libstd/hash/mod.rs b/src/libstd/hash/mod.rs index 6ab65809a3c..8e95263d48e 100644 --- a/src/libstd/hash/mod.rs +++ b/src/libstd/hash/mod.rs @@ -27,8 +27,8 @@ * phone: u64, * } * - * let person1 = Person { id: 5, name: "Janet".to_owned(), phone: 555_666_7777 }; - * let person2 = Person { id: 5, name: "Bob".to_owned(), phone: 555_666_7777 }; + * let person1 = Person { id: 5, name: "Janet".to_string(), phone: 555_666_7777 }; + * let person2 = Person { id: 5, name: "Bob".to_string(), phone: 555_666_7777 }; * * assert!(hash::hash(&person1) != hash::hash(&person2)); * ``` @@ -54,8 +54,8 @@ * } * } * - * let person1 = Person { id: 5, name: "Janet".to_owned(), phone: 555_666_7777 }; - * let person2 = Person { id: 5, name: "Bob".to_owned(), phone: 555_666_7777 }; + * let person1 = Person { id: 5, name: "Janet".to_string(), phone: 555_666_7777 }; + * let person2 = Person { id: 5, name: "Bob".to_string(), phone: 555_666_7777 }; * * assert!(hash::hash(&person1) == hash::hash(&person2)); * ``` diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index c22bc92fb65..c16c7737357 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1315,7 +1315,7 @@ pub trait Buffer: Reader { /// use std::io; /// /// let mut reader = io::stdin(); - /// let input = reader.read_line().ok().unwrap_or("nothing".to_owned()); + /// let input = reader.read_line().ok().unwrap_or("nothing".to_string()); /// ``` /// /// # Error diff --git a/src/libstd/slice.rs b/src/libstd/slice.rs index e1242e24537..ca75f33f0fe 100644 --- a/src/libstd/slice.rs +++ b/src/libstd/slice.rs @@ -396,7 +396,7 @@ pub trait OwnedVector<T> { /// # Examples /// /// ```rust - /// let v = ~["a".to_owned(), "b".to_owned()]; + /// let v = ~["a".to_string(), "b".to_string()]; /// for s in v.move_iter() { /// // s has type ~str, not &~str /// println!("{}", s); @@ -1186,7 +1186,7 @@ mod tests { assert_eq!(it.next(), None); } { - let v = ["Hello".to_owned()]; + let v = ["Hello".to_string()]; let mut it = v.permutations(); let (min_size, max_opt) = it.size_hint(); assert_eq!(min_size, 1); diff --git a/src/libstd/str.rs b/src/libstd/str.rs index b57c329983e..988c029c9b9 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -330,7 +330,7 @@ Section: Misc /// // 𝄞music /// let mut v = [0xD834, 0xDD1E, 0x006d, 0x0075, /// 0x0073, 0x0069, 0x0063]; -/// assert_eq!(str::from_utf16(v), Some("𝄞music".to_owned())); +/// assert_eq!(str::from_utf16(v), Some("𝄞music".to_string())); /// /// // 𝄞mu<invalid>ic /// v[4] = 0xD800; @@ -360,7 +360,7 @@ pub fn from_utf16(v: &[u16]) -> Option<String> { /// 0xD834]; /// /// assert_eq!(str::from_utf16_lossy(v), -/// "𝄞mus\uFFFDic\uFFFD".to_owned()); +/// "𝄞mus\uFFFDic\uFFFD".to_string()); /// ``` pub fn from_utf16_lossy(v: &[u16]) -> String { utf16_items(v).map(|c| c.to_char_lossy()).collect() @@ -609,7 +609,7 @@ impl<'a> StrAllocating for MaybeOwned<'a> { #[inline] fn into_owned(self) -> String { match self { - Slice(s) => s.to_owned(), + Slice(s) => s.to_string(), Owned(s) => s } } @@ -625,7 +625,7 @@ impl<'a> Clone for MaybeOwned<'a> { fn clone(&self) -> MaybeOwned<'a> { match *self { Slice(s) => Slice(s), - Owned(ref s) => Owned(s.to_owned()) + Owned(ref s) => Owned(s.to_string()) } } } @@ -710,7 +710,7 @@ pub mod raw { let a = ~[65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8]; let b = a.as_ptr(); let c = from_buf_len(b, 3u); - assert_eq!(c, "AAA".to_owned()); + assert_eq!(c, "AAA".to_string()); } } } @@ -771,11 +771,11 @@ pub trait StrAllocating: Str { /// /// ```rust /// let s = "Do you know the muffin man, - /// The muffin man, the muffin man, ...".to_owned(); + /// The muffin man, the muffin man, ...".to_string(); /// /// assert_eq!(s.replace("muffin man", "little lamb"), /// "Do you know the little lamb, - /// The little lamb, the little lamb, ...".to_owned()); + /// The little lamb, the little lamb, ...".to_string()); /// /// // not found, so no change. /// assert_eq!(s.replace("cookie monster", "little lamb"), s); @@ -793,7 +793,8 @@ pub trait StrAllocating: Str { result } - /// Copy a slice into a new `String`. + #[allow(missing_doc)] + #[deprecated = "obsolete, use `to_string`"] #[inline] fn to_owned(&self) -> String { use slice::Vector; @@ -888,7 +889,7 @@ pub trait StrAllocating: Str { impl<'a> StrAllocating for &'a str { #[inline] fn into_owned(self) -> String { - self.to_owned() + self.to_string() } } @@ -981,17 +982,17 @@ mod tests { #[test] fn test_collect() { - let empty = "".to_owned(); + let empty = "".to_string(); let s: String = empty.as_slice().chars().collect(); assert_eq!(empty, s); - let data = "ประเทศไทย中".to_owned(); + let data = "ประเทศไทย中".to_string(); let s: String = data.as_slice().chars().collect(); assert_eq!(data, s); } #[test] fn test_into_bytes() { - let data = "asdf".to_owned(); + let data = "asdf".to_string(); let buf = data.into_bytes(); assert_eq!(bytes!("asdf"), buf.as_slice()); } @@ -1045,11 +1046,11 @@ mod tests { fn t(v: &[String], s: &str) { assert_eq!(v.concat(), s.to_str().into_owned()); } - t(["you".to_owned(), "know".to_owned(), "I'm".to_owned(), - "no".to_owned(), "good".to_owned()], "youknowI'mnogood"); + t(["you".to_string(), "know".to_string(), "I'm".to_string(), + "no".to_string(), "good".to_string()], "youknowI'mnogood"); let v: &[String] = []; t(v, ""); - t(["hi".to_owned()], "hi"); + t(["hi".to_string()], "hi"); } #[test] @@ -1057,12 +1058,12 @@ mod tests { fn t(v: &[String], sep: &str, s: &str) { assert_eq!(v.connect(sep), s.to_str().into_owned()); } - t(["you".to_owned(), "know".to_owned(), "I'm".to_owned(), - "no".to_owned(), "good".to_owned()], + t(["you".to_string(), "know".to_string(), "I'm".to_string(), + "no".to_string(), "good".to_string()], " ", "you know I'm no good"); let v: &[String] = []; t(v, " ", ""); - t(["hi".to_owned()], " ", "hi"); + t(["hi".to_string()], " ", "hi"); } #[test] @@ -1089,11 +1090,11 @@ mod tests { #[test] fn test_repeat() { - assert_eq!("x".repeat(4), "xxxx".to_owned()); - assert_eq!("hi".repeat(4), "hihihihi".to_owned()); - assert_eq!("ไท华".repeat(3), "ไท华ไท华ไท华".to_owned()); - assert_eq!("".repeat(4), "".to_owned()); - assert_eq!("hi".repeat(0), "".to_owned()); + assert_eq!("x".repeat(4), "xxxx".to_string()); + assert_eq!("hi".repeat(4), "hihihihi".to_string()); + assert_eq!("ไท华".repeat(3), "ไท华ไท华ไท华".to_string()); + assert_eq!("".repeat(4), "".to_string()); + assert_eq!("hi".repeat(0), "".to_string()); } #[test] @@ -1157,13 +1158,13 @@ mod tests { #[test] fn test_replace() { let a = "a"; - assert_eq!("".replace(a, "b"), "".to_owned()); - assert_eq!("a".replace(a, "b"), "b".to_owned()); - assert_eq!("ab".replace(a, "b"), "bb".to_owned()); + assert_eq!("".replace(a, "b"), "".to_string()); + assert_eq!("a".replace(a, "b"), "b".to_string()); + assert_eq!("ab".replace(a, "b"), "bb".to_string()); let test = "test"; assert!(" test test ".replace(test, "toast") == - " toast toast ".to_owned()); - assert_eq!(" test test ".replace(test, ""), " ".to_owned()); + " toast toast ".to_string()); + assert_eq!(" test test ".replace(test, ""), " ".to_string()); } #[test] @@ -1466,7 +1467,7 @@ mod tests { let a = box [65, 65, 65, 65, 65, 65, 65, 0]; let b = a.as_ptr(); let c = raw::from_c_str(b); - assert_eq!(c, "AAAAAAA".to_owned()); + assert_eq!(c, "AAAAAAA".to_string()); } } @@ -1488,7 +1489,7 @@ mod tests { fn test_as_bytes_fail() { // Don't double free. (I'm not sure if this exercises the // original problem code path anymore.) - let s = "".to_owned(); + let s = "".to_string(); let _bytes = s.as_bytes(); fail!(); } @@ -1577,13 +1578,13 @@ mod tests { #[test] fn test_utf16() { let pairs = - [("𐍅𐌿𐌻𐍆𐌹𐌻𐌰\n".to_owned(), + [("𐍅𐌿𐌻𐍆𐌹𐌻𐌰\n".to_string(), vec![0xd800_u16, 0xdf45_u16, 0xd800_u16, 0xdf3f_u16, 0xd800_u16, 0xdf3b_u16, 0xd800_u16, 0xdf46_u16, 0xd800_u16, 0xdf39_u16, 0xd800_u16, 0xdf3b_u16, 0xd800_u16, 0xdf30_u16, 0x000a_u16]), - ("𐐒𐑉𐐮𐑀𐐲𐑋 𐐏𐐲𐑍\n".to_owned(), + ("𐐒𐑉𐐮𐑀𐐲𐑋 𐐏𐐲𐑍\n".to_string(), vec![0xd801_u16, 0xdc12_u16, 0xd801_u16, 0xdc49_u16, 0xd801_u16, 0xdc2e_u16, 0xd801_u16, 0xdc40_u16, 0xd801_u16, 0xdc32_u16, 0xd801_u16, @@ -1591,7 +1592,7 @@ mod tests { 0xd801_u16, 0xdc32_u16, 0xd801_u16, 0xdc4d_u16, 0x000a_u16]), - ("𐌀𐌖𐌋𐌄𐌑𐌉·𐌌𐌄𐌕𐌄𐌋𐌉𐌑\n".to_owned(), + ("𐌀𐌖𐌋𐌄𐌑𐌉·𐌌𐌄𐌕𐌄𐌋𐌉𐌑\n".to_string(), vec![0xd800_u16, 0xdf00_u16, 0xd800_u16, 0xdf16_u16, 0xd800_u16, 0xdf0b_u16, 0xd800_u16, 0xdf04_u16, 0xd800_u16, 0xdf11_u16, 0xd800_u16, 0xdf09_u16, @@ -1600,7 +1601,7 @@ mod tests { 0xdf04_u16, 0xd800_u16, 0xdf0b_u16, 0xd800_u16, 0xdf09_u16, 0xd800_u16, 0xdf11_u16, 0x000a_u16 ]), - ("𐒋𐒘𐒈𐒑𐒛𐒒 𐒕𐒓 𐒈𐒚𐒍 𐒏𐒜𐒒𐒖𐒆 𐒕𐒆\n".to_owned(), + ("𐒋𐒘𐒈𐒑𐒛𐒒 𐒕𐒓 𐒈𐒚𐒍 𐒏𐒜𐒒𐒖𐒆 𐒕𐒆\n".to_string(), vec![0xd801_u16, 0xdc8b_u16, 0xd801_u16, 0xdc98_u16, 0xd801_u16, 0xdc88_u16, 0xd801_u16, 0xdc91_u16, 0xd801_u16, 0xdc9b_u16, 0xd801_u16, 0xdc92_u16, @@ -1613,7 +1614,7 @@ mod tests { 0xd801_u16, 0xdc95_u16, 0xd801_u16, 0xdc86_u16, 0x000a_u16 ]), // Issue #12318, even-numbered non-BMP planes - ("\U00020000".to_owned(), + ("\U00020000".to_string(), vec![0xD840, 0xDC00])]; for p in pairs.iter() { @@ -1648,15 +1649,16 @@ mod tests { fn test_utf16_lossy() { // completely positive cases tested above. // lead + eof - assert_eq!(from_utf16_lossy([0xD800]), "\uFFFD".to_owned()); + assert_eq!(from_utf16_lossy([0xD800]), "\uFFFD".to_string()); // lead + lead - assert_eq!(from_utf16_lossy([0xD800, 0xD800]), "\uFFFD\uFFFD".to_owned()); + assert_eq!(from_utf16_lossy([0xD800, 0xD800]), "\uFFFD\uFFFD".to_string()); // isolated trail - assert_eq!(from_utf16_lossy([0x0061, 0xDC00]), "a\uFFFD".to_owned()); + assert_eq!(from_utf16_lossy([0x0061, 0xDC00]), "a\uFFFD".to_string()); // general - assert_eq!(from_utf16_lossy([0xD800, 0xd801, 0xdc8b, 0xD800]), "\uFFFD𐒋\uFFFD".to_owned()); + assert_eq!(from_utf16_lossy([0xD800, 0xd801, 0xdc8b, 0xD800]), + "\uFFFD𐒋\uFFFD".to_string()); } #[test] @@ -1701,27 +1703,27 @@ mod tests { #[test] fn test_escape_unicode() { - assert_eq!("abc".escape_unicode(), "\\x61\\x62\\x63".to_owned()); - assert_eq!("a c".escape_unicode(), "\\x61\\x20\\x63".to_owned()); - assert_eq!("\r\n\t".escape_unicode(), "\\x0d\\x0a\\x09".to_owned()); - assert_eq!("'\"\\".escape_unicode(), "\\x27\\x22\\x5c".to_owned()); - assert_eq!("\x00\x01\xfe\xff".escape_unicode(), "\\x00\\x01\\xfe\\xff".to_owned()); - assert_eq!("\u0100\uffff".escape_unicode(), "\\u0100\\uffff".to_owned()); - assert_eq!("\U00010000\U0010ffff".escape_unicode(), "\\U00010000\\U0010ffff".to_owned()); - assert_eq!("ab\ufb00".escape_unicode(), "\\x61\\x62\\ufb00".to_owned()); - assert_eq!("\U0001d4ea\r".escape_unicode(), "\\U0001d4ea\\x0d".to_owned()); + assert_eq!("abc".escape_unicode(), "\\x61\\x62\\x63".to_string()); + assert_eq!("a c".escape_unicode(), "\\x61\\x20\\x63".to_string()); + assert_eq!("\r\n\t".escape_unicode(), "\\x0d\\x0a\\x09".to_string()); + assert_eq!("'\"\\".escape_unicode(), "\\x27\\x22\\x5c".to_string()); + assert_eq!("\x00\x01\xfe\xff".escape_unicode(), "\\x00\\x01\\xfe\\xff".to_string()); + assert_eq!("\u0100\uffff".escape_unicode(), "\\u0100\\uffff".to_string()); + assert_eq!("\U00010000\U0010ffff".escape_unicode(), "\\U00010000\\U0010ffff".to_string()); + assert_eq!("ab\ufb00".escape_unicode(), "\\x61\\x62\\ufb00".to_string()); + assert_eq!("\U0001d4ea\r".escape_unicode(), "\\U0001d4ea\\x0d".to_string()); } #[test] fn test_escape_default() { - assert_eq!("abc".escape_default(), "abc".to_owned()); - assert_eq!("a c".escape_default(), "a c".to_owned()); - assert_eq!("\r\n\t".escape_default(), "\\r\\n\\t".to_owned()); - assert_eq!("'\"\\".escape_default(), "\\'\\\"\\\\".to_owned()); - assert_eq!("\u0100\uffff".escape_default(), "\\u0100\\uffff".to_owned()); - assert_eq!("\U00010000\U0010ffff".escape_default(), "\\U00010000\\U0010ffff".to_owned()); - assert_eq!("ab\ufb00".escape_default(), "ab\\ufb00".to_owned()); - assert_eq!("\U0001d4ea\r".escape_default(), "\\U0001d4ea\\r".to_owned()); + assert_eq!("abc".escape_default(), "abc".to_string()); + assert_eq!("a c".escape_default(), "a c".to_string()); + assert_eq!("\r\n\t".escape_default(), "\\r\\n\\t".to_string()); + assert_eq!("'\"\\".escape_default(), "\\'\\\"\\\\".to_string()); + assert_eq!("\u0100\uffff".escape_default(), "\\u0100\\uffff".to_string()); + assert_eq!("\U00010000\U0010ffff".escape_default(), "\\U00010000\\U0010ffff".to_string()); + assert_eq!("ab\ufb00".escape_default(), "ab\\ufb00".to_string()); + assert_eq!("\U0001d4ea\r".escape_default(), "\\U0001d4ea\\r".to_string()); } #[test] @@ -2043,9 +2045,10 @@ mod tests { v.iter().map(|x| x.len()).sum() } - let s = "01234".to_owned(); + let s = "01234".to_string(); assert_eq!(5, sum_len(["012", "", "34"])); - assert_eq!(5, sum_len(["01".to_owned(), "2".to_owned(), "34".to_owned(), "".to_owned()])); + assert_eq!(5, sum_len(["01".to_string(), "2".to_string(), + "34".to_string(), "".to_string()])); assert_eq!(5, sum_len([s.as_slice()])); } @@ -2064,10 +2067,10 @@ mod tests { #[test] fn test_str_from_utf8_owned() { let xs = Vec::from_slice(bytes!("hello")); - assert_eq!(from_utf8_owned(xs), Ok("hello".to_owned())); + assert_eq!(from_utf8_owned(xs), Ok("hello".to_string())); let xs = Vec::from_slice(bytes!("ศไทย中华Việt Nam")); - assert_eq!(from_utf8_owned(xs), Ok("ศไทย中华Việt Nam".to_owned())); + assert_eq!(from_utf8_owned(xs), Ok("ศไทย中华Việt Nam".to_string())); let xs = Vec::from_slice(bytes!("hello", 0xff)); assert_eq!(from_utf8_owned(xs), @@ -2083,28 +2086,28 @@ mod tests { assert_eq!(from_utf8_lossy(xs), Slice("ศไทย中华Việt Nam")); let xs = bytes!("Hello", 0xC2, " There", 0xFF, " Goodbye"); - assert_eq!(from_utf8_lossy(xs), Owned("Hello\uFFFD There\uFFFD Goodbye".to_owned())); + assert_eq!(from_utf8_lossy(xs), Owned("Hello\uFFFD There\uFFFD Goodbye".to_string())); let xs = bytes!("Hello", 0xC0, 0x80, " There", 0xE6, 0x83, " Goodbye"); - assert_eq!(from_utf8_lossy(xs), Owned("Hello\uFFFD\uFFFD There\uFFFD Goodbye".to_owned())); + assert_eq!(from_utf8_lossy(xs), Owned("Hello\uFFFD\uFFFD There\uFFFD Goodbye".to_string())); let xs = bytes!(0xF5, "foo", 0xF5, 0x80, "bar"); - assert_eq!(from_utf8_lossy(xs), Owned("\uFFFDfoo\uFFFD\uFFFDbar".to_owned())); + assert_eq!(from_utf8_lossy(xs), Owned("\uFFFDfoo\uFFFD\uFFFDbar".to_string())); let xs = bytes!(0xF1, "foo", 0xF1, 0x80, "bar", 0xF1, 0x80, 0x80, "baz"); - assert_eq!(from_utf8_lossy(xs), Owned("\uFFFDfoo\uFFFDbar\uFFFDbaz".to_owned())); + assert_eq!(from_utf8_lossy(xs), Owned("\uFFFDfoo\uFFFDbar\uFFFDbaz".to_string())); let xs = bytes!(0xF4, "foo", 0xF4, 0x80, "bar", 0xF4, 0xBF, "baz"); - assert_eq!(from_utf8_lossy(xs), Owned("\uFFFDfoo\uFFFDbar\uFFFD\uFFFDbaz".to_owned())); + assert_eq!(from_utf8_lossy(xs), Owned("\uFFFDfoo\uFFFDbar\uFFFD\uFFFDbaz".to_string())); let xs = bytes!(0xF0, 0x80, 0x80, 0x80, "foo", 0xF0, 0x90, 0x80, 0x80, "bar"); assert_eq!(from_utf8_lossy(xs), Owned("\uFFFD\uFFFD\uFFFD\uFFFD\ - foo\U00010000bar".to_owned())); + foo\U00010000bar".to_string())); // surrogates let xs = bytes!(0xED, 0xA0, 0x80, "foo", 0xED, 0xBF, 0xBF, "bar"); assert_eq!(from_utf8_lossy(xs), Owned("\uFFFD\uFFFD\uFFFDfoo\ - \uFFFD\uFFFD\uFFFDbar".to_owned())); + \uFFFD\uFFFD\uFFFDbar".to_string())); } #[test] @@ -2118,18 +2121,18 @@ mod tests { let s = Slice("abcde"); assert_eq!(s.len(), 5); assert_eq!(s.as_slice(), "abcde"); - assert_eq!(s.to_str(), "abcde".to_strbuf()); - assert_eq!(format_strbuf!("{}", s), "abcde".to_strbuf()); - assert!(s.lt(&Owned("bcdef".to_owned()))); + assert_eq!(s.to_str(), "abcde".to_string()); + assert_eq!(format_strbuf!("{}", s), "abcde".to_string()); + assert!(s.lt(&Owned("bcdef".to_string()))); assert_eq!(Slice(""), Default::default()); - let o = Owned("abcde".to_owned()); + let o = Owned("abcde".to_string()); assert_eq!(o.len(), 5); assert_eq!(o.as_slice(), "abcde"); assert_eq!(o.to_str(), "abcde".to_strbuf()); assert_eq!(format_strbuf!("{}", o), "abcde".to_strbuf()); assert!(o.lt(&Slice("bcdef"))); - assert_eq!(Owned("".to_owned()), Default::default()); + assert_eq!(Owned("".to_string()), Default::default()); assert!(s.cmp(&o) == Equal); assert!(s.equiv(&o)); @@ -2144,31 +2147,31 @@ mod tests { assert!(s.is_slice()); assert!(!s.is_owned()); - let o = Owned("abcde".to_owned()); + let o = Owned("abcde".to_string()); assert!(!o.is_slice()); assert!(o.is_owned()); } #[test] fn test_maybe_owned_clone() { - assert_eq!(Owned("abcde".to_owned()), Slice("abcde").clone()); - assert_eq!(Owned("abcde".to_owned()), Owned("abcde".to_owned()).clone()); + assert_eq!(Owned("abcde".to_string()), Slice("abcde").clone()); + assert_eq!(Owned("abcde".to_string()), Owned("abcde".to_string()).clone()); assert_eq!(Slice("abcde"), Slice("abcde").clone()); - assert_eq!(Slice("abcde"), Owned("abcde".to_owned()).clone()); + assert_eq!(Slice("abcde"), Owned("abcde".to_string()).clone()); } #[test] fn test_maybe_owned_into_owned() { - assert_eq!(Slice("abcde").into_owned(), "abcde".to_owned()); - assert_eq!(Owned("abcde".to_owned()).into_owned(), "abcde".to_owned()); + assert_eq!(Slice("abcde").into_owned(), "abcde".to_string()); + assert_eq!(Owned("abcde".to_string()).into_owned(), "abcde".to_string()); } #[test] fn test_into_maybe_owned() { assert_eq!("abcde".into_maybe_owned(), Slice("abcde")); - assert_eq!(("abcde".to_owned()).into_maybe_owned(), Slice("abcde")); - assert_eq!("abcde".into_maybe_owned(), Owned("abcde".to_owned())); - assert_eq!(("abcde".to_owned()).into_maybe_owned(), Owned("abcde".to_owned())); + assert_eq!(("abcde".to_string()).into_maybe_owned(), Slice("abcde")); + assert_eq!("abcde".into_maybe_owned(), Owned("abcde".to_string())); + assert_eq!(("abcde".to_string()).into_maybe_owned(), Owned("abcde".to_string())); } } diff --git a/src/libstd/task.rs b/src/libstd/task.rs index 078883aac13..37244b26ad5 100644 --- a/src/libstd/task.rs +++ b/src/libstd/task.rs @@ -295,7 +295,7 @@ fn test_unnamed_task() { #[test] fn test_owned_named_task() { - TaskBuilder::new().named("ada lovelace".to_owned()).spawn(proc() { + TaskBuilder::new().named("ada lovelace".to_string()).spawn(proc() { with_task_name(|name| { assert!(name.unwrap() == "ada lovelace"); }) @@ -367,7 +367,7 @@ fn test_back_to_the_future_result() { #[test] fn test_try_success() { match try(proc() { - "Success!".to_owned() + "Success!".to_string() }).as_ref().map(|s| s.as_slice()) { result::Ok("Success!") => (), _ => fail!() diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 3c1e83e1b54..24330584714 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -669,7 +669,7 @@ impl<T> Vec<T> { /// # Example /// /// ```rust - /// let v = vec!("a".to_owned(), "b".to_owned()); + /// let v = vec!("a".to_string(), "b".to_string()); /// for s in v.move_iter() { /// // s has type String, not &String /// println!("{}", s); @@ -874,13 +874,14 @@ impl<T> Vec<T> { /// /// # Example /// ```rust - /// let mut v = vec!("foo".to_owned(), "bar".to_owned(), "baz".to_owned(), "qux".to_owned()); + /// let mut v = vec!("foo".to_string(), "bar".to_string(), + /// "baz".to_string(), "qux".to_string()); /// - /// assert_eq!(v.swap_remove(1), Some("bar".to_owned())); - /// assert_eq!(v, vec!("foo".to_owned(), "qux".to_owned(), "baz".to_owned())); + /// assert_eq!(v.swap_remove(1), Some("bar".to_string())); + /// assert_eq!(v, vec!("foo".to_string(), "qux".to_string(), "baz".to_string())); /// - /// assert_eq!(v.swap_remove(0), Some("foo".to_owned())); - /// assert_eq!(v, vec!("baz".to_owned(), "qux".to_owned())); + /// assert_eq!(v.swap_remove(0), Some("foo".to_string())); + /// assert_eq!(v, vec!("baz".to_string(), "qux".to_string())); /// /// assert_eq!(v.swap_remove(2), None); /// ``` diff --git a/src/libsync/comm.rs b/src/libsync/comm.rs index 6cc98cd69ca..eefa4da82a1 100644 --- a/src/libsync/comm.rs +++ b/src/libsync/comm.rs @@ -60,10 +60,10 @@ mod test { pub fn DuplexStream1() { let (left, right) = duplex(); - left.send("abc".to_owned()); + left.send("abc".to_string()); right.send(123); assert!(left.recv() == 123); - assert!(right.recv() == "abc".to_owned()); + assert!(right.recv() == "abc".to_string()); } } diff --git a/src/libsync/future.rs b/src/libsync/future.rs index a854d44aab0..0ce19e8f00a 100644 --- a/src/libsync/future.rs +++ b/src/libsync/future.rs @@ -143,34 +143,34 @@ mod test { #[test] fn test_from_value() { - let mut f = Future::from_value("snail".to_owned()); - assert_eq!(f.get(), "snail".to_owned()); + let mut f = Future::from_value("snail".to_string()); + assert_eq!(f.get(), "snail".to_string()); } #[test] fn test_from_receiver() { let (tx, rx) = channel(); - tx.send("whale".to_owned()); + tx.send("whale".to_string()); let mut f = Future::from_receiver(rx); - assert_eq!(f.get(), "whale".to_owned()); + assert_eq!(f.get(), "whale".to_string()); } #[test] fn test_from_fn() { - let mut f = Future::from_fn(proc() "brail".to_owned()); - assert_eq!(f.get(), "brail".to_owned()); + let mut f = Future::from_fn(proc() "brail".to_string()); + assert_eq!(f.get(), "brail".to_string()); } #[test] fn test_interface_get() { - let mut f = Future::from_value("fail".to_owned()); - assert_eq!(f.get(), "fail".to_owned()); + let mut f = Future::from_value("fail".to_string()); + assert_eq!(f.get(), "fail".to_string()); } #[test] fn test_interface_unwrap() { - let f = Future::from_value("fail".to_owned()); - assert_eq!(f.unwrap(), "fail".to_owned()); + let f = Future::from_value("fail".to_string()); + assert_eq!(f.unwrap(), "fail".to_string()); } #[test] @@ -181,8 +181,8 @@ mod test { #[test] fn test_spawn() { - let mut f = Future::spawn(proc() "bale".to_owned()); - assert_eq!(f.get(), "bale".to_owned()); + let mut f = Future::spawn(proc() "bale".to_string()); + assert_eq!(f.get(), "bale".to_string()); } #[test] diff --git a/src/libsyntax/crateid.rs b/src/libsyntax/crateid.rs index 06b3ed91a5a..fea165eb2ce 100644 --- a/src/libsyntax/crateid.rs +++ b/src/libsyntax/crateid.rs @@ -52,7 +52,7 @@ impl fmt::Show for CrateId { impl FromStr for CrateId { fn from_str(s: &str) -> Option<CrateId> { let pieces: Vec<&str> = s.splitn('#', 1).collect(); - let path = pieces.get(0).to_owned(); + let path = pieces.get(0).to_string(); if path.as_slice().starts_with("/") || path.as_slice().ends_with("/") || path.as_slice().starts_with(".") || path.is_empty() { diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index 822084df2f6..06916d5ac09 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -57,7 +57,7 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) let mut asm_str_style = None; let mut outputs = Vec::new(); let mut inputs = Vec::new(); - let mut cons = "".to_owned(); + let mut cons = "".to_string(); let mut volatile = false; let mut alignstack = false; let mut dialect = ast::AsmAtt; diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs index b8a3eea0014..d6b7e84b535 100644 --- a/src/libsyntax/ext/deriving/encodable.rs +++ b/src/libsyntax/ext/deriving/encodable.rs @@ -36,7 +36,7 @@ impl<D:Decoder> Decodable for node_id { fn decode(d: &D) -> Node { d.read_struct("Node", 1, || { Node { - id: d.read_field("x".to_owned(), 0, || decode(d)) + id: d.read_field("x".to_string(), 0, || decode(d)) } }) } @@ -73,8 +73,8 @@ would yield functions like: fn decode(d: &D) -> spanned<T> { d.read_rec(|| { { - node: d.read_field("node".to_owned(), 0, || decode(d)), - span: d.read_field("span".to_owned(), 1, || decode(d)), + node: d.read_field("node".to_string(), 0, || decode(d)), + span: d.read_field("span".to_string(), 1, || decode(d)), } }) } diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 5f330631819..ce8ada7071b 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -430,11 +430,11 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { LIT_INT(i, ity) => { let s_ity = match ity { - ast::TyI => "TyI".to_owned(), - ast::TyI8 => "TyI8".to_owned(), - ast::TyI16 => "TyI16".to_owned(), - ast::TyI32 => "TyI32".to_owned(), - ast::TyI64 => "TyI64".to_owned() + ast::TyI => "TyI".to_string(), + ast::TyI8 => "TyI8".to_string(), + ast::TyI16 => "TyI16".to_string(), + ast::TyI32 => "TyI32".to_string(), + ast::TyI64 => "TyI64".to_string() }; let e_ity = cx.expr_ident(sp, id_ext(s_ity.as_slice())); @@ -447,11 +447,11 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { LIT_UINT(u, uty) => { let s_uty = match uty { - ast::TyU => "TyU".to_owned(), - ast::TyU8 => "TyU8".to_owned(), - ast::TyU16 => "TyU16".to_owned(), - ast::TyU32 => "TyU32".to_owned(), - ast::TyU64 => "TyU64".to_owned() + ast::TyU => "TyU".to_string(), + ast::TyU8 => "TyU8".to_string(), + ast::TyU16 => "TyU16".to_string(), + ast::TyU32 => "TyU32".to_string(), + ast::TyU64 => "TyU64".to_string() }; let e_uty = cx.expr_ident(sp, id_ext(s_uty.as_slice())); @@ -472,9 +472,9 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { LIT_FLOAT(fident, fty) => { let s_fty = match fty { - ast::TyF32 => "TyF32".to_owned(), - ast::TyF64 => "TyF64".to_owned(), - ast::TyF128 => "TyF128".to_owned() + ast::TyF32 => "TyF32".to_string(), + ast::TyF64 => "TyF64".to_string(), + ast::TyF128 => "TyF128".to_string() }; let e_fty = cx.expr_ident(sp, id_ext(s_fty.as_slice())); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ae5f16c2580..b5ddd6cd20f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4159,7 +4159,7 @@ impl<'a> Parser<'a> { outer_attrs, "path") { Some(d) => (dir_path.join(d), true), None => { - let mod_name = mod_string.get().to_owned(); + let mod_name = mod_string.get().to_string(); let default_path_str = format!("{}.rs", mod_name); let secondary_path_str = format!("{}/mod.rs", mod_name); let default_path = dir_path.join(default_path_str.as_slice()); diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index 5625a14a4f2..33589f29624 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -217,7 +217,7 @@ pub fn parse(file: &mut io::Reader, longnames: bool) // don't read NUL let bytes = try!(file.read_exact(names_bytes as uint - 1)); let names_str = match str::from_utf8(bytes.as_slice()) { - Some(s) => s.to_owned(), + Some(s) => s.to_string(), None => return Err("input not utf-8".to_strbuf()), }; diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index f10f16cc070..0398738ee0a 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -1026,8 +1026,8 @@ pub fn run_test(opts: &TestOpts, let stdout = ChanWriter::new(tx.clone()); let stderr = ChanWriter::new(tx); let mut task = TaskBuilder::new().named(match desc.name { - DynTestName(ref name) => name.clone().to_owned(), - StaticTestName(name) => name.to_owned(), + DynTestName(ref name) => name.clone().to_string(), + StaticTestName(name) => name.to_string(), }); if nocapture { drop((stdout, stderr)); diff --git a/src/test/bench/core-uint-to-str.rs b/src/test/bench/core-uint-to-str.rs index 381527763c9..1c51ea055d0 100644 --- a/src/test/bench/core-uint-to-str.rs +++ b/src/test/bench/core-uint-to-str.rs @@ -14,9 +14,9 @@ use std::uint; fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_owned(), "10000000".to_owned()) + vec!("".to_string(), "10000000".to_string()) } else if args.len() <= 1u { - vec!("".to_owned(), "100000".to_owned()) + vec!("".to_string(), "100000".to_string()) } else { args.move_iter().collect() }; diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs index 633ac6ebcdf..108093acfb4 100644 --- a/src/test/bench/msgsend-ring-mutex-arcs.rs +++ b/src/test/bench/msgsend-ring-mutex-arcs.rs @@ -63,9 +63,9 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) { fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_owned(), "100".to_owned(), "10000".to_owned()) + vec!("".to_string(), "100".to_string(), "10000".to_string()) } else if args.len() <= 1u { - vec!("".to_owned(), "10".to_owned(), "100".to_owned()) + vec!("".to_string(), "10".to_string(), "100".to_string()) } else { args.clone().move_iter().collect() }; diff --git a/src/test/bench/msgsend-ring-rw-arcs.rs b/src/test/bench/msgsend-ring-rw-arcs.rs index a324f10fb33..38a894c4b3d 100644 --- a/src/test/bench/msgsend-ring-rw-arcs.rs +++ b/src/test/bench/msgsend-ring-rw-arcs.rs @@ -64,9 +64,9 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) { fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_owned(), "100".to_owned(), "10000".to_owned()) + vec!("".to_string(), "100".to_string(), "10000".to_string()) } else if args.len() <= 1u { - vec!("".to_owned(), "10".to_owned(), "100".to_owned()) + vec!("".to_string(), "10".to_string(), "100".to_string()) } else { args.clone().move_iter().collect() }; diff --git a/src/test/bench/shootout-ackermann.rs b/src/test/bench/shootout-ackermann.rs index e0116931538..d8eceec6321 100644 --- a/src/test/bench/shootout-ackermann.rs +++ b/src/test/bench/shootout-ackermann.rs @@ -25,9 +25,9 @@ fn ack(m: int, n: int) -> int { fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_owned(), "12".to_owned()) + vec!("".to_string(), "12".to_string()) } else if args.len() <= 1u { - vec!("".to_owned(), "8".to_owned()) + vec!("".to_string(), "8".to_string()) } else { args.move_iter().collect() }; diff --git a/src/test/bench/shootout-fibo.rs b/src/test/bench/shootout-fibo.rs index 76f96f8d43b..83db926ad6c 100644 --- a/src/test/bench/shootout-fibo.rs +++ b/src/test/bench/shootout-fibo.rs @@ -21,9 +21,9 @@ fn fib(n: int) -> int { fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_owned(), "40".to_owned()) + vec!("".to_string(), "40".to_string()) } else if args.len() <= 1u { - vec!("".to_owned(), "30".to_owned()) + vec!("".to_string(), "30".to_string()) } else { args.move_iter().collect() }; diff --git a/src/test/bench/std-smallintmap.rs b/src/test/bench/std-smallintmap.rs index 3b26de9cf47..f774be582a1 100644 --- a/src/test/bench/std-smallintmap.rs +++ b/src/test/bench/std-smallintmap.rs @@ -32,9 +32,9 @@ fn check_sequential(min: uint, max: uint, map: &SmallIntMap<uint>) { fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_owned(), "100000".to_owned(), "100".to_owned()) + vec!("".to_string(), "100000".to_string(), "100".to_string()) } else if args.len() <= 1u { - vec!("".to_owned(), "10000".to_owned(), "50".to_owned()) + vec!("".to_string(), "10000".to_string(), "50".to_string()) } else { args.move_iter().collect() }; diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index 0485e10a38b..9235882d1f4 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -67,7 +67,7 @@ impl Sudoku { pub fn read(mut reader: BufferedReader<StdReader>) -> Sudoku { /* assert first line is exactly "9,9" */ - assert!(reader.read_line().unwrap() == "9,9".to_owned()); + assert!(reader.read_line().unwrap() == "9,9".to_string()); let mut g = Vec::from_fn(10u, { |_i| vec!(0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8) }); for line in reader.lines() { diff --git a/src/test/bench/task-perf-jargon-metal-smoke.rs b/src/test/bench/task-perf-jargon-metal-smoke.rs index 1669f41374d..c631e3e04f2 100644 --- a/src/test/bench/task-perf-jargon-metal-smoke.rs +++ b/src/test/bench/task-perf-jargon-metal-smoke.rs @@ -41,9 +41,9 @@ fn child_generation(gens_left: uint, tx: comm::Sender<()>) { fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_owned(), "100000".to_owned()) + vec!("".to_string(), "100000".to_string()) } else if args.len() <= 1 { - vec!("".to_owned(), "100".to_owned()) + vec!("".to_string(), "100".to_string()) } else { args.clone().move_iter().collect() }; diff --git a/src/test/bench/task-perf-one-million.rs b/src/test/bench/task-perf-one-million.rs index 0b712923d88..c980d531bb5 100644 --- a/src/test/bench/task-perf-one-million.rs +++ b/src/test/bench/task-perf-one-million.rs @@ -49,9 +49,9 @@ fn calc(children: uint, parent_wait_chan: &Sender<Sender<Sender<int>>>) { fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_owned(), "30".to_owned()) + vec!("".to_string(), "30".to_string()) } else if args.len() <= 1u { - vec!("".to_owned(), "10".to_owned()) + vec!("".to_string(), "10".to_string()) } else { args }; diff --git a/src/test/bench/task-perf-spawnalot.rs b/src/test/bench/task-perf-spawnalot.rs index cb5eb77df6c..8b090d6d7fb 100644 --- a/src/test/bench/task-perf-spawnalot.rs +++ b/src/test/bench/task-perf-spawnalot.rs @@ -25,9 +25,9 @@ fn g() { } fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_owned(), "400".to_owned()) + vec!("".to_string(), "400".to_string()) } else if args.len() <= 1u { - vec!("".to_owned(), "10".to_owned()) + vec!("".to_string(), "10".to_string()) } else { args.move_iter().collect() }; diff --git a/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs b/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs index ce51c5acd19..c7b573562e3 100644 --- a/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs +++ b/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs @@ -19,7 +19,7 @@ fn arg_closure() { } fn let_pat() { - let &_x = &"hi".to_owned(); + let &_x = &"hi".to_string(); //~^ ERROR cannot move out of dereference of `&`-pointer } diff --git a/src/test/compile-fail/borrowck-move-out-of-overloaded-deref.rs b/src/test/compile-fail/borrowck-move-out-of-overloaded-deref.rs index cb1ac467c76..8a93790d5a2 100644 --- a/src/test/compile-fail/borrowck-move-out-of-overloaded-deref.rs +++ b/src/test/compile-fail/borrowck-move-out-of-overloaded-deref.rs @@ -11,6 +11,6 @@ use std::rc::Rc; pub fn main() { - let _x = *Rc::new("hi".to_owned()); + let _x = *Rc::new("hi".to_string()); //~^ ERROR cannot move out of dereference of `&`-pointer } diff --git a/src/test/compile-fail/borrowck-ref-into-rvalue.rs b/src/test/compile-fail/borrowck-ref-into-rvalue.rs index 1b83e61cc35..ba1d3a9ddba 100644 --- a/src/test/compile-fail/borrowck-ref-into-rvalue.rs +++ b/src/test/compile-fail/borrowck-ref-into-rvalue.rs @@ -10,7 +10,7 @@ fn main() { let msg; - match Some("Hello".to_owned()) { + match Some("Hello".to_string()) { Some(ref m) => { //~ ERROR borrowed value does not live long enough msg = m; }, diff --git a/src/test/compile-fail/circular_modules_main.rs b/src/test/compile-fail/circular_modules_main.rs index ad1596d002e..ac5ec1236ff 100644 --- a/src/test/compile-fail/circular_modules_main.rs +++ b/src/test/compile-fail/circular_modules_main.rs @@ -12,7 +12,7 @@ mod circular_modules_hello; //~ERROR: circular modules pub fn hi_str() -> String { - "Hi!".to_owned() + "Hi!".to_string() } fn main() { diff --git a/src/test/compile-fail/error-should-say-copy-not-pod.rs b/src/test/compile-fail/error-should-say-copy-not-pod.rs index 2722943407b..9186dada780 100644 --- a/src/test/compile-fail/error-should-say-copy-not-pod.rs +++ b/src/test/compile-fail/error-should-say-copy-not-pod.rs @@ -13,5 +13,5 @@ fn check_bound<T:Copy>(_: T) {} fn main() { - check_bound("nocopy".to_owned()); //~ ERROR does not fulfill `Copy` + check_bound("nocopy".to_string()); //~ ERROR does not fulfill `Copy` } diff --git a/src/test/compile-fail/issue-10412.rs b/src/test/compile-fail/issue-10412.rs index 47ad473c577..8a99633b4fc 100644 --- a/src/test/compile-fail/issue-10412.rs +++ b/src/test/compile-fail/issue-10412.rs @@ -26,7 +26,7 @@ impl<'self> Serializable<str> for &'self str { //~ ERROR no longer a special lif fn main() { println!("hello"); - let x = "foo".to_owned(); + let x = "foo".to_string(); let y = x; println!("{}", y); } diff --git a/src/test/compile-fail/issue-6458-4.rs b/src/test/compile-fail/issue-6458-4.rs index b0adc89cf30..e920976069a 100644 --- a/src/test/compile-fail/issue-6458-4.rs +++ b/src/test/compile-fail/issue-6458-4.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo(b: bool) -> Result<bool,String> { - Err("bar".to_owned()); + Err("bar".to_string()); //~^ ERROR: cannot determine a type for this expression: unconstrained type } diff --git a/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs b/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs index b68d3f6d8e4..97287c147d7 100644 --- a/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs +++ b/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs @@ -11,7 +11,7 @@ use std::task; fn main() { - let x = "Hello world!".to_owned(); + let x = "Hello world!".to_string(); task::spawn(proc() { println!("{}", x); }); diff --git a/src/test/compile-fail/moves-based-on-type-distribute-copy-over-paren.rs b/src/test/compile-fail/moves-based-on-type-distribute-copy-over-paren.rs index 07fa6b27cc4..f30360af46e 100644 --- a/src/test/compile-fail/moves-based-on-type-distribute-copy-over-paren.rs +++ b/src/test/compile-fail/moves-based-on-type-distribute-copy-over-paren.rs @@ -15,37 +15,37 @@ struct Foo<A> { f: A } fn touch<A>(_a: &A) {} fn f00() { - let x = "hi".to_owned(); + let x = "hi".to_string(); let _y = Foo { f:x }; //~ NOTE `x` moved here touch(&x); //~ ERROR use of moved value: `x` } fn f05() { - let x = "hi".to_owned(); + let x = "hi".to_string(); let _y = Foo { f:(((x))) }; //~ NOTE `x` moved here touch(&x); //~ ERROR use of moved value: `x` } fn f10() { - let x = "hi".to_owned(); + let x = "hi".to_string(); let _y = Foo { f:x.clone() }; touch(&x); } fn f20() { - let x = "hi".to_owned(); + let x = "hi".to_string(); let _y = Foo { f:(x).clone() }; touch(&x); } fn f30() { - let x = "hi".to_owned(); + let x = "hi".to_string(); let _y = Foo { f:((x)).clone() }; touch(&x); } fn f40() { - let x = "hi".to_owned(); + let x = "hi".to_string(); let _y = Foo { f:(((((((x)).clone()))))) }; touch(&x); } diff --git a/src/test/compile-fail/moves-based-on-type-match-bindings.rs b/src/test/compile-fail/moves-based-on-type-match-bindings.rs index b0bdda6c850..65ae25396c8 100644 --- a/src/test/compile-fail/moves-based-on-type-match-bindings.rs +++ b/src/test/compile-fail/moves-based-on-type-match-bindings.rs @@ -17,7 +17,7 @@ fn guard(_s: String) -> bool {fail!()} fn touch<A>(_a: &A) {} fn f10() { - let x = Foo {f: "hi".to_owned()}; + let x = Foo {f: "hi".to_string()}; let y = match x { Foo {f} => {} //~ NOTE moved here diff --git a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs b/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs index 6556d0a51f8..3521347705b 100644 --- a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs +++ b/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs @@ -20,7 +20,7 @@ struct R<'a> { } fn innocent_looking_victim() { - let mut x = Some("hello".to_owned()); + let mut x = Some("hello".to_string()); conspirator(|f, writer| { if writer { x = None; diff --git a/src/test/compile-fail/multitrait.rs b/src/test/compile-fail/multitrait.rs index f16e70777ed..f772b96c697 100644 --- a/src/test/compile-fail/multitrait.rs +++ b/src/test/compile-fail/multitrait.rs @@ -14,5 +14,5 @@ struct S { impl Cmp, ToStr for S { //~ ERROR: expected `{` but found `,` fn eq(&&other: S) { false } - fn to_str(&self) -> String { "hi".to_owned() } + fn to_str(&self) -> String { "hi".to_string() } } diff --git a/src/test/compile-fail/syntax-extension-minor.rs b/src/test/compile-fail/syntax-extension-minor.rs index 38a09143e3c..d1e50638138 100644 --- a/src/test/compile-fail/syntax-extension-minor.rs +++ b/src/test/compile-fail/syntax-extension-minor.rs @@ -13,8 +13,8 @@ #![feature(concat_idents)] pub fn main() { - let asdf_fdsa = "<.<".to_owned(); - assert_eq!(concat_idents!(asd, f_f, dsa), "<.<".to_owned()); + let asdf_fdsa = "<.<".to_string(); + assert_eq!(concat_idents!(asd, f_f, dsa), "<.<".to_string()); //~^ ERROR: unresolved name `asdf_fdsa` assert!(stringify!(use_mention_distinction) == diff --git a/src/test/compile-fail/trait-coercion-generic-regions.rs b/src/test/compile-fail/trait-coercion-generic-regions.rs index cf7a5c4ad14..5f4d51918ed 100644 --- a/src/test/compile-fail/trait-coercion-generic-regions.rs +++ b/src/test/compile-fail/trait-coercion-generic-regions.rs @@ -24,7 +24,7 @@ impl Trait<&'static str> for Struct { } fn main() { - let person = "Fred".to_owned(); + let person = "Fred".to_string(); let person: &str = person.as_slice(); //~ ERROR `person` does not live long enough let s: Box<Trait<&'static str>> = box Struct { person: person }; } diff --git a/src/test/compile-fail/use-after-move-based-on-type.rs b/src/test/compile-fail/use-after-move-based-on-type.rs index 28eb4a12739..e2167ca446f 100644 --- a/src/test/compile-fail/use-after-move-based-on-type.rs +++ b/src/test/compile-fail/use-after-move-based-on-type.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let x = "Hello!".to_owned(); + let x = "Hello!".to_string(); let _y = x; println!("{}", x); //~ ERROR use of moved value } diff --git a/src/test/pretty/match-naked-expr-medium.rs b/src/test/pretty/match-naked-expr-medium.rs index c05c3d7fe8f..5cf6d838f25 100644 --- a/src/test/pretty/match-naked-expr-medium.rs +++ b/src/test/pretty/match-naked-expr-medium.rs @@ -15,10 +15,10 @@ fn main() { let _y = match x { Some(_) => - ["some(_)".to_owned(), "not".to_owned(), "SO".to_owned(), - "long".to_owned(), "string".to_owned()], + ["some(_)".to_string(), "not".to_string(), "SO".to_string(), + "long".to_string(), "string".to_string()], None => - ["none".to_owned(), "a".to_owned(), "a".to_owned(), - "a".to_owned(), "a".to_owned()] + ["none".to_string(), "a".to_string(), "a".to_string(), + "a".to_string(), "a".to_string()] }; } diff --git a/src/test/pretty/match-naked-expr.rs b/src/test/pretty/match-naked-expr.rs index dd44f7de353..bb14a74fc18 100644 --- a/src/test/pretty/match-naked-expr.rs +++ b/src/test/pretty/match-naked-expr.rs @@ -14,7 +14,7 @@ fn main() { let x = Some(3); let _y = match x { - Some(_) => "some(_)".to_owned(), - None => "none".to_owned() + Some(_) => "some(_)".to_string(), + None => "none".to_string() }; } diff --git a/src/test/run-fail/fail-task-name-owned.rs b/src/test/run-fail/fail-task-name-owned.rs index f30af563aa6..ea643fd26d9 100644 --- a/src/test/run-fail/fail-task-name-owned.rs +++ b/src/test/run-fail/fail-task-name-owned.rs @@ -13,7 +13,7 @@ use std::task::TaskBuilder; fn main() { - TaskBuilder::new().named("owned name".to_owned()).try(proc() { + TaskBuilder::new().named("owned name".to_string()).try(proc() { fail!("test"); 1 }).unwrap() diff --git a/src/test/run-fail/unwind-box-str.rs b/src/test/run-fail/unwind-box-str.rs index 2e76c8150d8..08c8461afe0 100644 --- a/src/test/run-fail/unwind-box-str.rs +++ b/src/test/run-fail/unwind-box-str.rs @@ -17,7 +17,7 @@ fn failfn() { } fn main() { - let x = @"hi".to_owned(); + let x = @"hi".to_string(); failfn(); println!("{:?}", x); } diff --git a/src/test/run-fail/unwind-match.rs b/src/test/run-fail/unwind-match.rs index be22b368c0c..4af77c43482 100644 --- a/src/test/run-fail/unwind-match.rs +++ b/src/test/run-fail/unwind-match.rs @@ -16,9 +16,9 @@ fn test_box() { @0; } fn test_str() { - let res = match false { true => { "happy".to_owned() }, + let res = match false { true => { "happy".to_string() }, _ => fail!("non-exhaustive match failure") }; - assert_eq!(res, "happy".to_owned()); + assert_eq!(res, "happy".to_string()); } fn main() { test_box(); diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs index 85fbda610cb..36b525c134b 100644 --- a/src/test/run-pass-fulldeps/qquote.rs +++ b/src/test/run-pass-fulldeps/qquote.rs @@ -57,20 +57,20 @@ fn main() { let cx = mk_ctxt(); let abc = quote_expr!(cx, 23); - check_pp(ext_cx, abc, pprust::print_expr, "23".to_owned()); + check_pp(ext_cx, abc, pprust::print_expr, "23".to_string()); let ty = quote_ty!(cx, int); - check_pp(ext_cx, ty, pprust::print_type, "int".to_owned()); + check_pp(ext_cx, ty, pprust::print_type, "int".to_string()); let item = quote_item!(cx, static x : int = 10;).get(); - check_pp(ext_cx, item, pprust::print_item, "static x: int = 10;".to_owned()); + check_pp(ext_cx, item, pprust::print_item, "static x: int = 10;".to_string()); let stmt = quote_stmt!(cx, let x = 20;); - check_pp(ext_cx, *stmt, pprust::print_stmt, "let x = 20;".to_owned()); + check_pp(ext_cx, *stmt, pprust::print_stmt, "let x = 20;".to_string()); let pat = quote_pat!(cx, Some(_)); - check_pp(ext_cx, pat, pprust::print_pat, "Some(_)".to_owned()); + check_pp(ext_cx, pat, pprust::print_pat, "Some(_)".to_string()); } @@ -82,7 +82,7 @@ fn check_pp<T>(cx: fake_ext_ctxt, pp::eof(pp.s); }); stdout().write_line(s); - if expect != "".to_owned() { + if expect != "".to_string() { println!("expect: '%s', got: '%s'", expect, s); assert_eq!(s, expect); } diff --git a/src/test/run-pass/assert-eq-macro-success.rs b/src/test/run-pass/assert-eq-macro-success.rs index c32d513f074..4adf10636e6 100644 --- a/src/test/run-pass/assert-eq-macro-success.rs +++ b/src/test/run-pass/assert-eq-macro-success.rs @@ -15,7 +15,7 @@ struct Point { x : int } pub fn main() { assert_eq!(14,14); - assert_eq!("abc".to_owned(),"abc".to_owned()); + assert_eq!("abc".to_string(),"abc".to_string()); assert_eq!(box Point{x:34},box Point{x:34}); assert_eq!(&Point{x:34},&Point{x:34}); assert_eq!(@Point{x:34},@Point{x:34}); diff --git a/src/test/run-pass/box-compare.rs b/src/test/run-pass/box-compare.rs index 10a3db5808e..ba41b1ffe9d 100644 --- a/src/test/run-pass/box-compare.rs +++ b/src/test/run-pass/box-compare.rs @@ -12,6 +12,6 @@ pub fn main() { assert!((@1 < @3)); - assert!((@@"hello ".to_owned() > @@"hello".to_owned())); - assert!((@@@"hello".to_owned() != @@@"there".to_owned())); + assert!((@@"hello ".to_string() > @@"hello".to_string())); + assert!((@@@"hello".to_string() != @@@"there".to_string())); } diff --git a/src/test/run-pass/cci_nested_exe.rs b/src/test/run-pass/cci_nested_exe.rs index 7042f875111..beffc171cd5 100644 --- a/src/test/run-pass/cci_nested_exe.rs +++ b/src/test/run-pass/cci_nested_exe.rs @@ -17,14 +17,14 @@ use cci_nested_lib::*; pub fn main() { let lst = new_int_alist(); - alist_add(&lst, 22, "hi".to_owned()); - alist_add(&lst, 44, "ho".to_owned()); - assert_eq!(alist_get(&lst, 22), "hi".to_owned()); - assert_eq!(alist_get(&lst, 44), "ho".to_owned()); + alist_add(&lst, 22, "hi".to_string()); + alist_add(&lst, 44, "ho".to_string()); + assert_eq!(alist_get(&lst, 22), "hi".to_string()); + assert_eq!(alist_get(&lst, 44), "ho".to_string()); let lst = new_int_alist_2(); - alist_add(&lst, 22, "hi".to_owned()); - alist_add(&lst, 44, "ho".to_owned()); - assert_eq!(alist_get(&lst, 22), "hi".to_owned()); - assert_eq!(alist_get(&lst, 44), "ho".to_owned()); + alist_add(&lst, 22, "hi".to_string()); + alist_add(&lst, 44, "ho".to_string()); + assert_eq!(alist_get(&lst, 22), "hi".to_string()); + assert_eq!(alist_get(&lst, 44), "ho".to_string()); } diff --git a/src/test/run-pass/class-poly-methods-cross-crate.rs b/src/test/run-pass/class-poly-methods-cross-crate.rs index b6fdaf91dc8..94c78522df4 100644 --- a/src/test/run-pass/class-poly-methods-cross-crate.rs +++ b/src/test/run-pass/class-poly-methods-cross-crate.rs @@ -14,11 +14,11 @@ use cci_class_6::kitties::cat; pub fn main() { let mut nyan : cat<char> = cat::<char>(52u, 99, vec!('p')); - let mut kitty = cat(1000u, 2, vec!("tabby".to_owned())); + let mut kitty = cat(1000u, 2, vec!("tabby".to_string())); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); nyan.speak(vec!(1u,2u,3u)); assert_eq!(nyan.meow_count(), 55u); - kitty.speak(vec!("meow".to_owned(), "mew".to_owned(), "purr".to_owned(), "chirp".to_owned())); + kitty.speak(vec!("meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string())); assert_eq!(kitty.meow_count(), 1004u); } diff --git a/src/test/run-pass/class-poly-methods.rs b/src/test/run-pass/class-poly-methods.rs index 515613675cb..4f94673a2c0 100644 --- a/src/test/run-pass/class-poly-methods.rs +++ b/src/test/run-pass/class-poly-methods.rs @@ -33,11 +33,11 @@ fn cat<U>(in_x : uint, in_y : int, in_info: Vec<U> ) -> cat<U> { pub fn main() { let mut nyan : cat<int> = cat::<int>(52u, 99, vec!(9)); - let mut kitty = cat(1000u, 2, vec!("tabby".to_owned())); + let mut kitty = cat(1000u, 2, vec!("tabby".to_string())); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); nyan.speak(vec!(1,2,3)); assert_eq!(nyan.meow_count(), 55u); - kitty.speak(vec!("meow".to_owned(), "mew".to_owned(), "purr".to_owned(), "chirp".to_owned())); + kitty.speak(vec!("meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string())); assert_eq!(kitty.meow_count(), 1004u); } diff --git a/src/test/run-pass/cleanup-shortcircuit.rs b/src/test/run-pass/cleanup-shortcircuit.rs index 0c372deae2c..5597d5fa011 100644 --- a/src/test/run-pass/cleanup-shortcircuit.rs +++ b/src/test/run-pass/cleanup-shortcircuit.rs @@ -26,9 +26,9 @@ pub fn main() { let args = os::args(); let args = args.as_slice(); - // Here, the rvalue `"signal".to_owned()` requires cleanup. Older versions + // Here, the rvalue `"signal".to_string()` requires cleanup. Older versions // of the code had a problem that the cleanup scope for this - // expression was the end of the `if`, and as the `"signal".to_owned()` + // expression was the end of the `if`, and as the `"signal".to_string()` // expression was never evaluated, we wound up trying to clean // uninitialized memory. diff --git a/src/test/run-pass/const-bound.rs b/src/test/run-pass/const-bound.rs index c864db33b21..7ca4e25a74d 100644 --- a/src/test/run-pass/const-bound.rs +++ b/src/test/run-pass/const-bound.rs @@ -18,7 +18,7 @@ struct F { field: int } pub fn main() { /*foo(1); - foo("hi".to_owned()); + foo("hi".to_string()); foo(~[1, 2, 3]); foo(F{field: 42}); foo((1, 2u)); diff --git a/src/test/run-pass/const-str-ptr.rs b/src/test/run-pass/const-str-ptr.rs index 8569bc40d2e..77c7a08f4ca 100644 --- a/src/test/run-pass/const-str-ptr.rs +++ b/src/test/run-pass/const-str-ptr.rs @@ -18,12 +18,12 @@ pub fn main() { unsafe { let foo = &A as *u8; assert_eq!(str::raw::from_utf8(A), "hi"); - assert_eq!(str::raw::from_buf_len(foo, A.len()), "hi".to_owned()); - assert_eq!(str::raw::from_buf_len(C, B.len()), "hi".to_owned()); + assert_eq!(str::raw::from_buf_len(foo, A.len()), "hi".to_string()); + assert_eq!(str::raw::from_buf_len(C, B.len()), "hi".to_string()); assert!(*C == A[0]); assert!(*(&B[0] as *u8) == A[0]); let bar = str::raw::from_utf8(A).to_c_str(); - assert_eq!(bar.with_ref(|buf| str::raw::from_c_str(buf)), "hi".to_owned()); + assert_eq!(bar.with_ref(|buf| str::raw::from_c_str(buf)), "hi".to_string()); } } diff --git a/src/test/run-pass/expr-if-box.rs b/src/test/run-pass/expr-if-box.rs index 78e2d3caea9..3918f7eb73d 100644 --- a/src/test/run-pass/expr-if-box.rs +++ b/src/test/run-pass/expr-if-box.rs @@ -17,8 +17,8 @@ fn test_box() { } fn test_str() { - let rs = if true { "happy".to_owned() } else { "sad".to_owned() }; - assert_eq!(rs, "happy".to_owned()); + let rs = if true { "happy".to_string() } else { "sad".to_string() }; + assert_eq!(rs, "happy".to_string()); } pub fn main() { test_box(); test_str(); } diff --git a/src/test/run-pass/expr-match-box.rs b/src/test/run-pass/expr-match-box.rs index de08c537abb..457d3e8d986 100644 --- a/src/test/run-pass/expr-match-box.rs +++ b/src/test/run-pass/expr-match-box.rs @@ -17,9 +17,9 @@ fn test_box() { } fn test_str() { - let res = match true { true => { "happy".to_owned() }, + let res = match true { true => { "happy".to_string() }, _ => fail!("not happy at all") }; - assert_eq!(res, "happy".to_owned()); + assert_eq!(res, "happy".to_string()); } pub fn main() { test_box(); test_str(); } diff --git a/src/test/run-pass/generic-tag-corruption.rs b/src/test/run-pass/generic-tag-corruption.rs index 26fefabdf9d..52d7c4cb170 100644 --- a/src/test/run-pass/generic-tag-corruption.rs +++ b/src/test/run-pass/generic-tag-corruption.rs @@ -14,4 +14,4 @@ // This used to cause memory corruption in stage 0. enum thing<K> { some(K), } -pub fn main() { let _x = some("hi".to_owned()); } +pub fn main() { let _x = some("hi".to_string()); } diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index ca2420bc573..3b09cf0373e 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -52,7 +52,7 @@ pub fn main() { t!(format!("{}", 1.0f32), "1"); t!(format!("{}", 1.0f64), "1"); t!(format!("{}", "a"), "a"); - t!(format!("{}", "a".to_owned()), "a"); + t!(format!("{}", "a".to_string()), "a"); t!(format!("{}", false), "false"); t!(format!("{}", 'a'), "a"); @@ -66,7 +66,7 @@ pub fn main() { t!(format!("{:x}", 10u), "a"); t!(format!("{:X}", 10u), "A"); t!(format!("{:s}", "foo"), "foo"); - t!(format!("{:s}", "foo".to_owned()), "foo"); + t!(format!("{:s}", "foo".to_string()), "foo"); t!(format!("{:p}", 0x1234 as *int), "0x1234"); t!(format!("{:p}", 0x1234 as *mut int), "0x1234"); t!(format!("{:d}", A), "aloha"); diff --git a/src/test/run-pass/inferred-suffix-in-pattern-range.rs b/src/test/run-pass/inferred-suffix-in-pattern-range.rs index 97f9c6bef7f..b2b16c4ef84 100644 --- a/src/test/run-pass/inferred-suffix-in-pattern-range.rs +++ b/src/test/run-pass/inferred-suffix-in-pattern-range.rs @@ -11,22 +11,22 @@ pub fn main() { let x = 2; let x_message = match x { - 0 .. 1 => { "not many".to_owned() } - _ => { "lots".to_owned() } + 0 .. 1 => { "not many".to_string() } + _ => { "lots".to_string() } }; - assert_eq!(x_message, "lots".to_owned()); + assert_eq!(x_message, "lots".to_string()); let y = 2i; let y_message = match y { - 0 .. 1 => { "not many".to_owned() } - _ => { "lots".to_owned() } + 0 .. 1 => { "not many".to_string() } + _ => { "lots".to_string() } }; - assert_eq!(y_message, "lots".to_owned()); + assert_eq!(y_message, "lots".to_string()); let z = 1u64; let z_message = match z { - 0 .. 1 => { "not many".to_owned() } - _ => { "lots".to_owned() } + 0 .. 1 => { "not many".to_string() } + _ => { "lots".to_string() } }; - assert_eq!(z_message, "not many".to_owned()); + assert_eq!(z_message, "not many".to_string()); } diff --git a/src/test/run-pass/issue-1257.rs b/src/test/run-pass/issue-1257.rs index 3cb71cb75e0..7d5bd9d6a74 100644 --- a/src/test/run-pass/issue-1257.rs +++ b/src/test/run-pass/issue-1257.rs @@ -9,10 +9,10 @@ // except according to those terms. pub fn main () { - let mut line = "".to_owned(); + let mut line = "".to_string(); let mut i = 0; - while line != "exit".to_owned() { - line = if i == 9 { "exit".to_owned() } else { "notexit".to_owned() }; + while line != "exit".to_string() { + line = if i == 9 { "exit".to_string() } else { "notexit".to_string() }; i += 1; } } diff --git a/src/test/run-pass/issue-1974.rs b/src/test/run-pass/issue-1974.rs index 81d34667519..9d71aea01d0 100644 --- a/src/test/run-pass/issue-1974.rs +++ b/src/test/run-pass/issue-1974.rs @@ -11,8 +11,8 @@ // Issue 1974 // Don't double free the condition allocation pub fn main() { - let s = "hej".to_owned(); - while s != "".to_owned() { + let s = "hej".to_string(); + while s != "".to_string() { return; } } diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs index 9f337ecfe37..3422b9a799d 100644 --- a/src/test/run-pass/issue-2734.rs +++ b/src/test/run-pass/issue-2734.rs @@ -17,7 +17,7 @@ fn perform_hax<T: 'static>(x: Box<T>) -> Box<hax:> { } fn deadcode() { - perform_hax(box "deadcode".to_owned()); + perform_hax(box "deadcode".to_string()); } pub fn main() { diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs index bdaf8ac9755..8a5391773bb 100644 --- a/src/test/run-pass/issue-2735.rs +++ b/src/test/run-pass/issue-2735.rs @@ -17,7 +17,7 @@ fn perform_hax<T: 'static>(x: Box<T>) -> Box<hax:> { } fn deadcode() { - perform_hax(box "deadcode".to_owned()); + perform_hax(box "deadcode".to_string()); } pub fn main() { diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index 2ce3cb931e5..5542418ebdd 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -30,14 +30,14 @@ enum square { impl fmt::Show for square { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", match *self { - bot => { "R".to_owned() } - wall => { "#".to_owned() } - rock => { "*".to_owned() } - lambda => { "\\".to_owned() } - closed_lift => { "L".to_owned() } - open_lift => { "O".to_owned() } - earth => { ".".to_owned() } - empty => { " ".to_owned() } + bot => { "R".to_string() } + wall => { "#".to_string() } + rock => { "*".to_string() } + lambda => { "\\".to_string() } + closed_lift => { "L".to_string() } + open_lift => { "O".to_string() } + earth => { ".".to_string() } + empty => { " ".to_string() } }) } } diff --git a/src/test/run-pass/issue-3556.rs b/src/test/run-pass/issue-3556.rs index 1e846663499..ac937423423 100644 --- a/src/test/run-pass/issue-3556.rs +++ b/src/test/run-pass/issue-3556.rs @@ -31,8 +31,8 @@ fn check_strs(actual: &str, expected: &str) -> bool pub fn main() { -// assert!(check_strs(fmt!("%?", Text(@"foo".to_owned())), "Text(@~\"foo\")")); -// assert!(check_strs(fmt!("%?", ETag(@~["foo".to_owned()], @"bar".to_owned())), +// assert!(check_strs(fmt!("%?", Text(@"foo".to_string())), "Text(@~\"foo\")")); +// assert!(check_strs(fmt!("%?", ETag(@~["foo".to_string()], @"bar".to_string())), // "ETag(@~[ ~\"foo\" ], @~\"bar\")")); let t = Text(@"foo".to_strbuf()); diff --git a/src/test/run-pass/issue-4241.rs b/src/test/run-pass/issue-4241.rs index 31fa2708488..b27720b8579 100644 --- a/src/test/run-pass/issue-4241.rs +++ b/src/test/run-pass/issue-4241.rs @@ -97,12 +97,12 @@ priv fn parse_response(io: @io::Reader) -> Result { } priv fn cmd_to_str(cmd: ~[String]) -> String { - let mut res = "*".to_owned(); + let mut res = "*".to_string(); res.push_str(cmd.len().to_str()); res.push_str("\r\n"); for s in cmd.iter() { - res.push_str(["$".to_owned(), s.len().to_str(), "\r\n".to_owned(), - (*s).clone(), "\r\n".to_owned()].concat() ); + res.push_str(["$".to_string(), s.len().to_str(), "\r\n".to_string(), + (*s).clone(), "\r\n".to_string()].concat() ); } res } @@ -117,7 +117,7 @@ fn query(cmd: ~[String], sb: TcpSocketBuf) -> Result { fn query2(cmd: ~[String]) -> Result { let _cmd = cmd_to_str(cmd); - io::with_str_reader("$3\r\nXXX\r\n".to_owned())(|sb| { + io::with_str_reader("$3\r\nXXX\r\n".to_string())(|sb| { let res = parse_response(@sb as @io::Reader); println!("{:?}", res); res diff --git a/src/test/run-pass/linear-for-loop.rs b/src/test/run-pass/linear-for-loop.rs index 2f8f16fb1ae..b260e0af9e3 100644 --- a/src/test/run-pass/linear-for-loop.rs +++ b/src/test/run-pass/linear-for-loop.rs @@ -14,7 +14,7 @@ pub fn main() { for i in x.iter() { println!("{:?}", *i); y += *i; } println!("{:?}", y); assert_eq!(y, 6); - let s = "hello there".to_owned(); + let s = "hello there".to_string(); let mut i: int = 0; for c in s.as_slice().bytes() { if i == 0 { assert!((c == 'h' as u8)); } diff --git a/src/test/run-pass/logging-separate-lines.rs b/src/test/run-pass/logging-separate-lines.rs index 06151e498f5..7f9a4593780 100644 --- a/src/test/run-pass/logging-separate-lines.rs +++ b/src/test/run-pass/logging-separate-lines.rs @@ -29,7 +29,7 @@ fn main() { return } - let env = [("RUST_LOG".to_owned(), "debug".to_owned())]; + let env = [("RUST_LOG".to_string(), "debug".to_string())]; let p = Command::new(args[0].as_slice()) .arg("child").env(env.as_slice()) .spawn().unwrap().wait_with_output().unwrap(); diff --git a/src/test/run-pass/match-pipe-binding.rs b/src/test/run-pass/match-pipe-binding.rs index 4a5874536cf..d17bf8500e0 100644 --- a/src/test/run-pass/match-pipe-binding.rs +++ b/src/test/run-pass/match-pipe-binding.rs @@ -10,10 +10,10 @@ fn test1() { // from issue 6338 - match ((1, "a".to_owned()), (2, "b".to_owned())) { + match ((1, "a".to_string()), (2, "b".to_string())) { ((1, a), (2, b)) | ((2, b), (1, a)) => { - assert_eq!(a, "a".to_owned()); - assert_eq!(b, "b".to_owned()); + assert_eq!(a, "a".to_string()); + assert_eq!(b, "b".to_string()); }, _ => fail!(), } diff --git a/src/test/run-pass/moves-based-on-type-capture-clause.rs b/src/test/run-pass/moves-based-on-type-capture-clause.rs index 5eb806fe859..7fd37969e67 100644 --- a/src/test/run-pass/moves-based-on-type-capture-clause.rs +++ b/src/test/run-pass/moves-based-on-type-capture-clause.rs @@ -11,7 +11,7 @@ use std::task; pub fn main() { - let x = "Hello world!".to_owned(); + let x = "Hello world!".to_string(); task::spawn(proc() { println!("{}", x); }); diff --git a/src/test/run-pass/overload-index-operator.rs b/src/test/run-pass/overload-index-operator.rs index b72c4f92ea3..c6f3dae7fc1 100644 --- a/src/test/run-pass/overload-index-operator.rs +++ b/src/test/run-pass/overload-index-operator.rs @@ -40,8 +40,8 @@ impl<K:Eq,V:Clone> Index<K,V> for AssociationList<K,V> { } pub fn main() { - let foo = "foo".to_owned(); - let bar = "bar".to_owned(); + let foo = "foo".to_string(); + let bar = "bar".to_string(); let mut list = AssociationList {pairs: Vec::new()}; list.push(foo.clone(), 22); diff --git a/src/test/run-pass/overloaded-autoderef.rs b/src/test/run-pass/overloaded-autoderef.rs index 3bacdac7876..c9d5d02c247 100644 --- a/src/test/run-pass/overloaded-autoderef.rs +++ b/src/test/run-pass/overloaded-autoderef.rs @@ -30,7 +30,7 @@ pub fn main() { *i.borrow_mut() = 5; assert_eq!((i_value, *i.borrow()), (2, 5)); - let s = Rc::new("foo".to_owned()); + let s = Rc::new("foo".to_string()); assert!(s.equiv(&("foo"))); assert_eq!(s.as_slice(), "foo"); diff --git a/src/test/run-pass/overloaded-deref.rs b/src/test/run-pass/overloaded-deref.rs index 28930af2962..b28494109de 100644 --- a/src/test/run-pass/overloaded-deref.rs +++ b/src/test/run-pass/overloaded-deref.rs @@ -28,8 +28,8 @@ pub fn main() { *(*i).borrow_mut() = 5; assert_eq!((i_value, *(*i).borrow()), (2, 5)); - let s = Rc::new("foo".to_owned()); - assert_eq!(*s, "foo".to_owned()); + let s = Rc::new("foo".to_string()); + assert_eq!(*s, "foo".to_string()); assert_eq!((*s).as_slice(), "foo"); let mut_s = Rc::new(RefCell::new(String::from_str("foo"))); diff --git a/src/test/run-pass/rename-directory.rs b/src/test/run-pass/rename-directory.rs index f371d08b960..bf7a8fabff3 100644 --- a/src/test/run-pass/rename-directory.rs +++ b/src/test/run-pass/rename-directory.rs @@ -35,7 +35,7 @@ fn rename_directory() { }) }); assert!((ostream as uint != 0u)); - let s = "hello".to_owned(); + let s = "hello".to_string(); "hello".with_c_str(|buf| { let write_len = libc::fwrite(buf as *libc::c_void, 1u as libc::size_t, diff --git a/src/test/run-pass/send_str_hashmap.rs b/src/test/run-pass/send_str_hashmap.rs index 869dd3f7ff1..90faf97893a 100644 --- a/src/test/run-pass/send_str_hashmap.rs +++ b/src/test/run-pass/send_str_hashmap.rs @@ -18,35 +18,35 @@ use std::option::Some; pub fn main() { let mut map: HashMap<SendStr, uint> = HashMap::new(); assert!(map.insert(Slice("foo"), 42)); - assert!(!map.insert(Owned("foo".to_owned()), 42)); + assert!(!map.insert(Owned("foo".to_string()), 42)); assert!(!map.insert(Slice("foo"), 42)); - assert!(!map.insert(Owned("foo".to_owned()), 42)); + assert!(!map.insert(Owned("foo".to_string()), 42)); assert!(!map.insert(Slice("foo"), 43)); - assert!(!map.insert(Owned("foo".to_owned()), 44)); + assert!(!map.insert(Owned("foo".to_string()), 44)); assert!(!map.insert(Slice("foo"), 45)); - assert!(!map.insert(Owned("foo".to_owned()), 46)); + assert!(!map.insert(Owned("foo".to_string()), 46)); let v = 46; - assert_eq!(map.find(&Owned("foo".to_owned())), Some(&v)); + assert_eq!(map.find(&Owned("foo".to_string())), Some(&v)); assert_eq!(map.find(&Slice("foo")), Some(&v)); let (a, b, c, d) = (50, 51, 52, 53); assert!(map.insert(Slice("abc"), a)); - assert!(map.insert(Owned("bcd".to_owned()), b)); + assert!(map.insert(Owned("bcd".to_string()), b)); assert!(map.insert(Slice("cde"), c)); - assert!(map.insert(Owned("def".to_owned()), d)); + assert!(map.insert(Owned("def".to_string()), d)); assert!(!map.insert(Slice("abc"), a)); - assert!(!map.insert(Owned("bcd".to_owned()), b)); + assert!(!map.insert(Owned("bcd".to_string()), b)); assert!(!map.insert(Slice("cde"), c)); - assert!(!map.insert(Owned("def".to_owned()), d)); + assert!(!map.insert(Owned("def".to_string()), d)); - assert!(!map.insert(Owned("abc".to_owned()), a)); + assert!(!map.insert(Owned("abc".to_string()), a)); assert!(!map.insert(Slice("bcd"), b)); - assert!(!map.insert(Owned("cde".to_owned()), c)); + assert!(!map.insert(Owned("cde".to_string()), c)); assert!(!map.insert(Slice("def"), d)); assert_eq!(map.find_equiv(&("abc")), Some(&a)); diff --git a/src/test/run-pass/send_str_treemap.rs b/src/test/run-pass/send_str_treemap.rs index 66d79966732..9c727314ffb 100644 --- a/src/test/run-pass/send_str_treemap.rs +++ b/src/test/run-pass/send_str_treemap.rs @@ -19,35 +19,35 @@ use std::option::Some; pub fn main() { let mut map: TreeMap<SendStr, uint> = TreeMap::new(); assert!(map.insert(Slice("foo"), 42)); - assert!(!map.insert(Owned("foo".to_owned()), 42)); + assert!(!map.insert(Owned("foo".to_string()), 42)); assert!(!map.insert(Slice("foo"), 42)); - assert!(!map.insert(Owned("foo".to_owned()), 42)); + assert!(!map.insert(Owned("foo".to_string()), 42)); assert!(!map.insert(Slice("foo"), 43)); - assert!(!map.insert(Owned("foo".to_owned()), 44)); + assert!(!map.insert(Owned("foo".to_string()), 44)); assert!(!map.insert(Slice("foo"), 45)); - assert!(!map.insert(Owned("foo".to_owned()), 46)); + assert!(!map.insert(Owned("foo".to_string()), 46)); let v = 46; - assert_eq!(map.find(&Owned("foo".to_owned())), Some(&v)); + assert_eq!(map.find(&Owned("foo".to_string())), Some(&v)); assert_eq!(map.find(&Slice("foo")), Some(&v)); let (a, b, c, d) = (50, 51, 52, 53); assert!(map.insert(Slice("abc"), a)); - assert!(map.insert(Owned("bcd".to_owned()), b)); + assert!(map.insert(Owned("bcd".to_string()), b)); assert!(map.insert(Slice("cde"), c)); - assert!(map.insert(Owned("def".to_owned()), d)); + assert!(map.insert(Owned("def".to_string()), d)); assert!(!map.insert(Slice("abc"), a)); - assert!(!map.insert(Owned("bcd".to_owned()), b)); + assert!(!map.insert(Owned("bcd".to_string()), b)); assert!(!map.insert(Slice("cde"), c)); - assert!(!map.insert(Owned("def".to_owned()), d)); + assert!(!map.insert(Owned("def".to_string()), d)); - assert!(!map.insert(Owned("abc".to_owned()), a)); + assert!(!map.insert(Owned("abc".to_string()), a)); assert!(!map.insert(Slice("bcd"), b)); - assert!(!map.insert(Owned("cde".to_owned()), c)); + assert!(!map.insert(Owned("cde".to_string()), c)); assert!(!map.insert(Slice("def"), d)); assert_eq!(map.find(&Slice("abc")), Some(&a)); @@ -55,14 +55,14 @@ pub fn main() { assert_eq!(map.find(&Slice("cde")), Some(&c)); assert_eq!(map.find(&Slice("def")), Some(&d)); - assert_eq!(map.find(&Owned("abc".to_owned())), Some(&a)); - assert_eq!(map.find(&Owned("bcd".to_owned())), Some(&b)); - assert_eq!(map.find(&Owned("cde".to_owned())), Some(&c)); - assert_eq!(map.find(&Owned("def".to_owned())), Some(&d)); + assert_eq!(map.find(&Owned("abc".to_string())), Some(&a)); + assert_eq!(map.find(&Owned("bcd".to_string())), Some(&b)); + assert_eq!(map.find(&Owned("cde".to_string())), Some(&c)); + assert_eq!(map.find(&Owned("def".to_string())), Some(&d)); assert!(map.pop(&Slice("foo")).is_some()); assert_eq!(map.move_iter().map(|(k, v)| format_strbuf!("{}{}", k, v)) .collect::<Vec<String>>() .concat(), - "abc50bcd51cde52def53".to_owned()); + "abc50bcd51cde52def53".to_string()); } diff --git a/src/test/run-pass/seq-compare.rs b/src/test/run-pass/seq-compare.rs index 16e661a1da0..ef14e0ba931 100644 --- a/src/test/run-pass/seq-compare.rs +++ b/src/test/run-pass/seq-compare.rs @@ -10,9 +10,9 @@ pub fn main() { - assert!(("hello".to_owned() < "hellr".to_owned())); - assert!(("hello ".to_owned() > "hello".to_owned())); - assert!(("hello".to_owned() != "there".to_owned())); + assert!(("hello".to_string() < "hellr".to_string())); + assert!(("hello ".to_string() > "hello".to_string())); + assert!(("hello".to_string() != "there".to_string())); assert!((vec!(1, 2, 3, 4) > vec!(1, 2, 3))); assert!((vec!(1, 2, 3) < vec!(1, 2, 3, 4))); assert!((vec!(1, 2, 4, 4) > vec!(1, 2, 3, 4))); diff --git a/src/test/run-pass/str-idx.rs b/src/test/run-pass/str-idx.rs index d65eb6415bf..75d7b3ed2cd 100644 --- a/src/test/run-pass/str-idx.rs +++ b/src/test/run-pass/str-idx.rs @@ -11,7 +11,7 @@ pub fn main() { - let s = "hello".to_owned(); + let s = "hello".to_string(); let c: u8 = s.as_slice()[4]; println!("{:?}", c); assert_eq!(c, 0x6f as u8); diff --git a/src/test/run-pass/struct-lit-functional-no-fields.rs b/src/test/run-pass/struct-lit-functional-no-fields.rs index 6cc3e79ac67..e8c18607f95 100644 --- a/src/test/run-pass/struct-lit-functional-no-fields.rs +++ b/src/test/run-pass/struct-lit-functional-no-fields.rs @@ -25,8 +25,8 @@ pub fn main() { assert_eq!(foo, foo_); let foo = Foo { - bar: "one".to_owned(), - baz: "two".to_owned() + bar: "one".to_string(), + baz: "two".to_string() }; let foo_ = foo.clone(); diff --git a/src/test/run-pass/task-comm-16.rs b/src/test/run-pass/task-comm-16.rs index 963121fff82..18336a60318 100644 --- a/src/test/run-pass/task-comm-16.rs +++ b/src/test/run-pass/task-comm-16.rs @@ -36,7 +36,7 @@ fn test_vec() { fn test_str() { let (tx, rx) = channel(); - let s0 = "test".to_owned(); + let s0 = "test".to_string(); tx.send(s0); let s1 = rx.recv(); assert_eq!(s1.as_slice()[0], 't' as u8); diff --git a/src/test/run-pass/trait-with-bounds-default.rs b/src/test/run-pass/trait-with-bounds-default.rs index 2cd0c541db5..fc4acfd5bb3 100644 --- a/src/test/run-pass/trait-with-bounds-default.rs +++ b/src/test/run-pass/trait-with-bounds-default.rs @@ -36,5 +36,5 @@ impl<T: Clone> Getter<T> for Option<T> { pub fn main() { assert_eq!(3.do_get2(), (3, 3)); - assert_eq!(Some("hi".to_owned()).do_get2(), ("hi".to_owned(), "hi".to_owned())); + assert_eq!(Some("hi".to_string()).do_get2(), ("hi".to_string(), "hi".to_string())); } diff --git a/src/test/run-pass/uniq-cc-generic.rs b/src/test/run-pass/uniq-cc-generic.rs index 8c36a66a1e7..4061a475e6c 100644 --- a/src/test/run-pass/uniq-cc-generic.rs +++ b/src/test/run-pass/uniq-cc-generic.rs @@ -29,7 +29,7 @@ fn make_uniq_closure<A:Send>(a: A) -> proc():Send -> uint { fn empty_pointy() -> @RefCell<Pointy> { return @RefCell::new(Pointy { a : none, - d : make_uniq_closure("hi".to_owned()) + d : make_uniq_closure("hi".to_string()) }) } |
