diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 9d575675cc8c9..c701c971b19df 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -208,7 +208,7 @@ pub fn opt_str<'a>(maybestr: &'a Option) -> &'a str { pub fn opt_str2(maybestr: Option) -> String { match maybestr { - None => "(none)".to_string(), + None => "(none)".to_owned(), Some(s) => s, } } @@ -292,10 +292,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_string()), - _ => vec!(".rc".to_string(), ".rs".to_string()) + Pretty => vec!(".rs".to_owned()), + _ => vec!(".rc".to_owned(), ".rs".to_owned()) }; - let invalid_prefixes = vec!(".".to_string(), "#".to_string(), "~".to_string()); + let invalid_prefixes = vec!(".".to_owned(), "#".to_owned(), "~".to_owned()); let name = testfile.file_name().unwrap().to_str().unwrap(); let mut valid = false; diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index a648e51497e79..06e30ddb0d249 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -153,7 +153,7 @@ pub fn load_props(testfile: &Path) -> TestProps { check_stdout: check_stdout, no_prefer_dynamic: no_prefer_dynamic, pretty_expanded: pretty_expanded, - pretty_mode: pretty_mode.unwrap_or("normal".to_string()), + pretty_mode: pretty_mode.unwrap_or("normal".to_owned()), pretty_compare_only: pretty_compare_only, forbid_output: forbid_output, } @@ -320,7 +320,7 @@ fn parse_exec_env(line: &str) -> Option<(String, String)> { .collect(); match strs.len() { - 1 => (strs.pop().unwrap(), "".to_string()), + 1 => (strs.pop().unwrap(), "".to_owned()), 2 => { let end = strs.pop().unwrap(); (strs.pop().unwrap(), end) @@ -345,7 +345,7 @@ fn parse_pp_exact(line: &str, testfile: &Path) -> Option { fn parse_name_directive(line: &str, directive: &str) -> bool { // This 'no-' rule is a quick hack to allow pretty-expanded and no-pretty-expanded to coexist - line.contains(directive) && !line.contains(&("no-".to_string() + directive)) + line.contains(directive) && !line.contains(&("no-".to_owned() + directive)) } pub fn parse_name_value_directive(line: &str, directive: &str) diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 185a969cbc627..2eadf05e3bad9 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -177,9 +177,9 @@ fn run_valgrind_test(config: &Config, props: &TestProps, testfile: &Path) { fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { if props.pp_exact.is_some() { - logv(config, "testing for exact pretty-printing".to_string()); + logv(config, "testing for exact pretty-printing".to_owned()); } else { - logv(config, "testing for converging pretty-printing".to_string()); + logv(config, "testing for converging pretty-printing".to_owned()); } let rounds = @@ -221,7 +221,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { if props.pp_exact.is_some() { // Now we have to care about line endings - let cr = "\r".to_string(); + let cr = "\r".to_owned(); actual = actual.replace(&cr, "").to_string(); expected = expected.replace(&cr, "").to_string(); } @@ -278,12 +278,12 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { pretty_type: String) -> ProcArgs { let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths - let mut args = vec!("-".to_string(), - "-Zunstable-options".to_string(), - "--pretty".to_string(), + let mut args = vec!("-".to_owned(), + "-Zunstable-options".to_owned(), + "--pretty".to_owned(), pretty_type, format!("--target={}", config.target), - "-L".to_string(), + "-L".to_owned(), aux_dir.to_str().unwrap().to_string()); args.extend(split_maybe_args(&config.target_rustcflags).into_iter()); args.extend(split_maybe_args(&props.compile_flags).into_iter()); @@ -325,13 +325,13 @@ actual:\n\ &*config.target }; // FIXME (#9639): This needs to handle non-utf8 paths - let mut args = vec!("-".to_string(), - "-Zno-trans".to_string(), - "--crate-type=lib".to_string(), + let mut args = vec!("-".to_owned(), + "-Zno-trans".to_owned(), + "--crate-type=lib".to_owned(), format!("--target={}", target), - "-L".to_string(), + "-L".to_owned(), config.build_base.to_str().unwrap().to_string(), - "-L".to_string(), + "-L".to_owned(), aux_dir.to_str().unwrap().to_string()); args.extend(split_maybe_args(&config.target_rustcflags).into_iter()); args.extend(split_maybe_args(&props.compile_flags).into_iter()); @@ -400,24 +400,24 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { &config.adb_path, None, &[ - "push".to_string(), + "push".to_owned(), exe_file.to_str().unwrap().to_string(), config.adb_test_dir.clone() ], - vec!(("".to_string(), "".to_string())), - Some("".to_string())) + vec!(("".to_owned(), "".to_owned())), + Some("".to_owned())) .expect(&format!("failed to exec `{:?}`", config.adb_path)); procsrv::run("", &config.adb_path, None, &[ - "forward".to_string(), - "tcp:5039".to_string(), - "tcp:5039".to_string() + "forward".to_owned(), + "tcp:5039".to_owned(), + "tcp:5039".to_owned() ], - vec!(("".to_string(), "".to_string())), - Some("".to_string())) + vec!(("".to_owned(), "".to_owned())), + Some("".to_owned())) .expect(&format!("failed to exec `{:?}`", config.adb_path)); let adb_arg = format!("export LD_LIBRARY_PATH={}; \ @@ -434,12 +434,12 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { , None, &[ - "shell".to_string(), + "shell".to_owned(), adb_arg.clone() ], - vec!(("".to_string(), - "".to_string())), - Some("".to_string())) + vec!(("".to_owned(), + "".to_owned())), + Some("".to_owned())) .expect(&format!("failed to exec `{:?}`", config.adb_path)); loop { //waiting 1 second for gdbserver start @@ -457,9 +457,9 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { let debugger_script = make_out_name(config, testfile, "debugger.script"); // FIXME (#9639): This needs to handle non-utf8 paths let debugger_opts = - vec!("-quiet".to_string(), - "-batch".to_string(), - "-nx".to_string(), + vec!("-quiet".to_owned(), + "-batch".to_owned(), + "-nx".to_owned(), format!("-command={}", debugger_script.to_str().unwrap())); let mut gdb_path = tool_path; @@ -472,7 +472,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { &gdb_path, None, &debugger_opts, - vec!(("".to_string(), "".to_string())), + vec!(("".to_owned(), "".to_owned())), None) .expect(&format!("failed to exec `{:?}`", gdb_path)); let cmdline = { @@ -567,9 +567,9 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { // FIXME (#9639): This needs to handle non-utf8 paths let debugger_opts = - vec!("-quiet".to_string(), - "-batch".to_string(), - "-nx".to_string(), + vec!("-quiet".to_owned(), + "-batch".to_owned(), + "-nx".to_owned(), format!("-command={}", debugger_script.to_str().unwrap())); let proc_args = ProcArgs { @@ -577,7 +577,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { args: debugger_opts, }; - let environment = vec![("PYTHONPATH".to_string(), rust_pp_module_abs_path)]; + let environment = vec![("PYTHONPATH".to_owned(), rust_pp_module_abs_path)]; debugger_run_result = compose_and_run(config, testfile, @@ -803,9 +803,9 @@ fn cleanup_debug_info_options(options: &Option) -> Option { // Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS. let options_to_remove = [ - "-O".to_string(), - "-g".to_string(), - "--debuginfo".to_string() + "-O".to_owned(), + "-g".to_owned(), + "--debuginfo".to_owned() ]; let new_options = split_maybe_args(options).into_iter() @@ -1142,14 +1142,14 @@ fn compile_test(config: &Config, props: &TestProps, } fn jit_test(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes { - compile_test_(config, props, testfile, &["--jit".to_string()]) + compile_test_(config, props, testfile, &["--jit".to_owned()]) } fn compile_test_(config: &Config, props: &TestProps, testfile: &Path, extra_args: &[String]) -> ProcRes { let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths - let mut link_args = vec!("-L".to_string(), + let mut link_args = vec!("-L".to_owned(), aux_dir.to_str().unwrap().to_string()); link_args.extend(extra_args.iter().cloned()); let args = make_compile_args(config, @@ -1165,9 +1165,9 @@ fn document(config: &Config, props: &TestProps, let out_dir = output_base_name(config, testfile); let _ = fs::remove_dir_all(&out_dir); ensure_dir(&out_dir); - let mut args = vec!["-L".to_string(), + let mut args = vec!["-L".to_owned(), aux_dir.to_str().unwrap().to_string(), - "-o".to_string(), + "-o".to_owned(), out_dir.to_str().unwrap().to_string(), testfile.to_str().unwrap().to_string()]; args.extend(extra_args.iter().cloned()); @@ -1212,7 +1212,7 @@ fn compose_and_run_compiler(config: &Config, props: &TestProps, 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_string(), + let extra_link_args = vec!["-L".to_owned(), aux_dir.to_str().unwrap().to_string()]; for rel_ab in &props.aux_builds { @@ -1231,9 +1231,9 @@ fn compose_and_run_compiler(config: &Config, props: &TestProps, // however, that if the library is built with `force_host` then it's // ok to be a dylib as the host should always support dylibs. if config.target.contains("musl") && !aux_props.force_host { - vec!("--crate-type=lib".to_string()) + vec!("--crate-type=lib".to_owned()) } else { - vec!("--crate-type=dylib".to_string()) + vec!("--crate-type=dylib".to_owned()) } }; crate_type.extend(extra_link_args.clone().into_iter()); @@ -1314,21 +1314,21 @@ fn make_compile_args(config: &Config, }; // FIXME (#9639): This needs to handle non-utf8 paths let mut args = vec!(testfile.to_str().unwrap().to_string(), - "-L".to_string(), + "-L".to_owned(), config.build_base.to_str().unwrap().to_string(), format!("--target={}", target)); args.push_all(&extras); if !props.no_prefer_dynamic { - args.push("-C".to_string()); - args.push("prefer-dynamic".to_string()); + args.push("-C".to_owned()); + args.push("prefer-dynamic".to_owned()); } let path = match xform_file { TargetLocation::ThisFile(path) => { - args.push("-o".to_string()); + args.push("-o".to_owned()); path } TargetLocation::ThisDirectory(path) => { - args.push("--out-dir".to_string()); + args.push("--out-dir".to_owned()); path } }; @@ -1535,12 +1535,12 @@ fn _arm_exec_compiled_test(config: &Config, &config.adb_path, None, &[ - "push".to_string(), + "push".to_owned(), args.prog.clone(), config.adb_test_dir.clone() ], - vec!(("".to_string(), "".to_string())), - Some("".to_string())) + vec!(("".to_owned(), "".to_owned())), + Some("".to_owned())) .expect(&format!("failed to exec `{}`", config.adb_path)); if config.verbose { @@ -1556,7 +1556,7 @@ fn _arm_exec_compiled_test(config: &Config, let mut runargs = Vec::new(); // run test via adb_run_wrapper - runargs.push("shell".to_string()); + runargs.push("shell".to_owned()); for (key, val) in env { runargs.push(format!("{}={}", key, val)); } @@ -1571,13 +1571,13 @@ fn _arm_exec_compiled_test(config: &Config, &config.adb_path, None, &runargs, - vec!(("".to_string(), "".to_string())), Some("".to_string())) + vec!(("".to_owned(), "".to_owned())), Some("".to_owned())) .expect(&format!("failed to exec `{}`", config.adb_path)); // get exitcode of result runargs = Vec::new(); - runargs.push("shell".to_string()); - runargs.push("cat".to_string()); + runargs.push("shell".to_owned()); + runargs.push("cat".to_owned()); runargs.push(format!("{}/{}.exitcode", config.adb_test_dir, prog_short)); let procsrv::Result{ out: exitcode_out, err: _, status: _ } = @@ -1585,8 +1585,8 @@ fn _arm_exec_compiled_test(config: &Config, &config.adb_path, None, &runargs, - vec!(("".to_string(), "".to_string())), - Some("".to_string())) + vec!(("".to_owned(), "".to_owned())), + Some("".to_owned())) .expect(&format!("failed to exec `{}`", config.adb_path)); let mut exitcode: i32 = 0; @@ -1600,8 +1600,8 @@ fn _arm_exec_compiled_test(config: &Config, // get stdout of result runargs = Vec::new(); - runargs.push("shell".to_string()); - runargs.push("cat".to_string()); + runargs.push("shell".to_owned()); + runargs.push("cat".to_owned()); runargs.push(format!("{}/{}.stdout", config.adb_test_dir, prog_short)); let procsrv::Result{ out: stdout_out, err: _, status: _ } = @@ -1609,14 +1609,14 @@ fn _arm_exec_compiled_test(config: &Config, &config.adb_path, None, &runargs, - vec!(("".to_string(), "".to_string())), - Some("".to_string())) + vec!(("".to_owned(), "".to_owned())), + Some("".to_owned())) .expect(&format!("failed to exec `{}`", config.adb_path)); // get stderr of result runargs = Vec::new(); - runargs.push("shell".to_string()); - runargs.push("cat".to_string()); + runargs.push("shell".to_owned()); + runargs.push("cat".to_owned()); runargs.push(format!("{}/{}.stderr", config.adb_test_dir, prog_short)); let procsrv::Result{ out: stderr_out, err: _, status: _ } = @@ -1624,8 +1624,8 @@ fn _arm_exec_compiled_test(config: &Config, &config.adb_path, None, &runargs, - vec!(("".to_string(), "".to_string())), - Some("".to_string())) + vec!(("".to_owned(), "".to_owned())), + Some("".to_owned())) .expect(&format!("failed to exec `{}`", config.adb_path)); dump_output(config, @@ -1653,15 +1653,15 @@ fn _arm_push_aux_shared_library(config: &Config, testfile: &Path) { &config.adb_path, None, &[ - "push".to_string(), + "push".to_owned(), file.to_str() .unwrap() .to_string(), config.adb_test_dir.to_string(), ], - vec!(("".to_string(), - "".to_string())), - Some("".to_string())) + vec!(("".to_owned(), + "".to_owned())), + Some("".to_owned())) .expect(&format!("failed to exec `{}`", config.adb_path)); if config.verbose { @@ -1679,10 +1679,10 @@ fn compile_test_and_save_ir(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes { let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths - let mut link_args = vec!("-L".to_string(), + let mut link_args = vec!("-L".to_owned(), aux_dir.to_str().unwrap().to_string()); - let llvm_args = vec!("--emit=llvm-ir".to_string(), - "--crate-type=lib".to_string()); + let llvm_args = vec!("--emit=llvm-ir".to_owned(), + "--crate-type=lib".to_owned()); link_args.extend(llvm_args.into_iter()); let args = make_compile_args(config, props, diff --git a/src/grammar/verify.rs b/src/grammar/verify.rs index 3235389f1d193..edd3a3d6d35ce 100644 --- a/src/grammar/verify.rs +++ b/src/grammar/verify.rs @@ -40,7 +40,7 @@ fn parse_token_list(file: &str) -> HashMap { let mut res = HashMap::new(); - res.insert("-1".to_string(), token::Eof); + res.insert("-1".to_owned(), token::Eof); for line in file.split('\n') { let eq = match line.trim().rfind('=') { diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 906a41a4d5314..0a7a882321579 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -115,7 +115,7 @@ //! // through a shared reference. //! let gadget_owner : Rc = Rc::new( //! Owner { -//! name: "Gadget Man".to_string(), +//! name: "Gadget Man".to_owned(), //! gadgets: RefCell::new(Vec::new()) //! } //! ); diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 5817cee24dc41..dfb488d04289a 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -630,7 +630,7 @@ mod tests { let arena = TypedArena::new(); for _ in 0..100000 { arena.alloc(Noncopy { - string: "hello world".to_string(), + string: "hello world".to_owned(), array: vec!( 1, 2, 3, 4, 5 ), }); } @@ -641,7 +641,7 @@ mod tests { let arena = TypedArena::new(); b.iter(|| { arena.alloc(Noncopy { - string: "hello world".to_string(), + string: "hello world".to_owned(), array: vec!( 1, 2, 3, 4, 5 ), }) }) @@ -651,7 +651,7 @@ mod tests { pub fn bench_noncopy_nonarena(b: &mut Bencher) { b.iter(|| { let _: Box<_> = box Noncopy { - string: "hello world".to_string(), + string: "hello world".to_owned(), array: vec!( 1, 2, 3, 4, 5 ), }; }) @@ -662,7 +662,7 @@ mod tests { let arena = Arena::new(); b.iter(|| { arena.alloc(|| Noncopy { - string: "hello world".to_string(), + string: "hello world".to_owned(), array: vec!( 1, 2, 3, 4, 5 ), }) }) diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs index 8e8fc0bedec6a..bf7804af7d657 100644 --- a/src/libcollections/borrow.rs +++ b/src/libcollections/borrow.rs @@ -55,7 +55,7 @@ pub trait Borrow { /// assert_eq!("Hello", s.borrow()); /// } /// - /// let s = "Hello".to_string(); + /// let s = "Hello".to_owned(); /// /// check(s); /// diff --git a/src/libcollections/fmt.rs b/src/libcollections/fmt.rs index 817a5baf3d1be..77e4a583acbdc 100644 --- a/src/libcollections/fmt.rs +++ b/src/libcollections/fmt.rs @@ -495,7 +495,7 @@ use string; /// use std::fmt; /// /// let s = fmt::format(format_args!("Hello, {}!", "world")); -/// assert_eq!(s, "Hello, world!".to_string()); +/// assert_eq!(s, "Hello, world!".to_owned()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn format(args: Arguments) -> string::String { diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 634b3f56e8e4c..015f7bc1ecc96 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -178,7 +178,7 @@ mod hack { assert_eq!(it.next(), None); } { - let v = ["Hello".to_string()]; + let v = ["Hello".to_owned()]; let mut it = permutations(&v); let (min_size, max_opt) = it.size_hint(); assert_eq!(min_size, 1); diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index a9725214c1953..e5942093a08ff 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -30,7 +30,7 @@ //! You can get a non-`'static` `&str` by taking a slice of a `String`: //! //! ``` -//! let some_string = "Hello, world.".to_string(); +//! let some_string = "Hello, world.".to_owned(); //! let s = &some_string; //! ``` //! diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 7ede6545b9fb2..77cf726394ae2 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -277,7 +277,7 @@ impl String { /// let mut v = &mut [0xD834, 0xDD1E, 0x006d, 0x0075, /// 0x0073, 0x0069, 0x0063]; /// assert_eq!(String::from_utf16(v).unwrap(), - /// "𝄞music".to_string()); + /// "𝄞music".to_owned()); /// /// // 𝄞muic /// v[4] = 0xD800; @@ -307,7 +307,7 @@ impl String { /// 0xD834]; /// /// assert_eq!(String::from_utf16_lossy(v), - /// "𝄞mus\u{FFFD}ic\u{FFFD}".to_string()); + /// "𝄞mus\u{FFFD}ic\u{FFFD}".to_owned()); /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] @@ -648,7 +648,7 @@ impl String { /// # Examples /// /// ``` - /// let a = "foo".to_string(); + /// let a = "foo".to_owned(); /// assert_eq!(a.len(), 3); /// ``` #[inline] @@ -674,7 +674,7 @@ impl String { /// # Examples /// /// ``` - /// let mut s = "foo".to_string(); + /// let mut s = "foo".to_owned(); /// s.clear(); /// assert!(s.is_empty()); /// ``` diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 0cc0108fd0116..3897c3b749735 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1521,7 +1521,7 @@ impl IntoIterator for Vec { /// # Examples /// /// ``` - /// let v = vec!["a".to_string(), "b".to_string()]; + /// let v = vec!["a".to_owned(), "b".to_owned()]; /// for s in v.into_iter() { /// // s has type String, not &String /// println!("{}", s); diff --git a/src/libcollectionstest/str.rs b/src/libcollectionstest/str.rs index 1019e98153e6b..c5d58552b4a5f 100644 --- a/src/libcollectionstest/str.rs +++ b/src/libcollectionstest/str.rs @@ -170,7 +170,7 @@ macro_rules! test_connect { #[test] fn test_connect_for_different_types() { test_connect!("a-b", ["a", "b"], "-"); - let hyphen = "-".to_string(); + let hyphen = "-".to_owned(); test_connect!("a-b", [s("a"), s("b")], &*hyphen); test_connect!("a-b", vec!["a", "b"], &*hyphen); test_connect!("a-b", &*vec!["a", "b"], "-"); @@ -1516,7 +1516,7 @@ fn test_pattern_deref_forward() { let data = "aabcdaa"; assert!(data.contains("bcd")); assert!(data.contains(&"bcd")); - assert!(data.contains(&"bcd".to_string())); + assert!(data.contains(&"bcd".to_owned())); } #[test] diff --git a/src/libcollectionstest/string.rs b/src/libcollectionstest/string.rs index a1c7209f23b44..92353b3f1d494 100644 --- a/src/libcollectionstest/string.rs +++ b/src/libcollectionstest/string.rs @@ -272,7 +272,7 @@ fn test_str_add() { #[test] fn remove() { - let mut s = "ศไทย中华Việt Nam; foobar".to_string();; + let mut s = "ศไทย中华Việt Nam; foobar".to_owned();; assert_eq!(s.remove(0), 'ศ'); assert_eq!(s.len(), 33); assert_eq!(s, "ไทย中华Việt Nam; foobar"); @@ -282,24 +282,24 @@ fn remove() { #[test] #[should_panic] fn remove_bad() { - "ศ".to_string().remove(1); + "ศ".to_owned().remove(1); } #[test] fn insert() { - let mut s = "foobar".to_string(); + let mut s = "foobar".to_owned(); s.insert(0, 'ệ'); assert_eq!(s, "ệfoobar"); s.insert(6, 'ย'); assert_eq!(s, "ệfooยbar"); } -#[test] #[should_panic] fn insert_bad1() { "".to_string().insert(1, 't'); } -#[test] #[should_panic] fn insert_bad2() { "ệ".to_string().insert(1, 't'); } +#[test] #[should_panic] fn insert_bad1() { "".to_owned().insert(1, 't'); } +#[test] #[should_panic] fn insert_bad2() { "ệ".to_owned().insert(1, 't'); } #[test] fn test_slicing() { - let s = "foobar".to_string(); + let s = "foobar".to_owned(); assert_eq!("foobar", &s[..]); assert_eq!("foo", &s[..3]); assert_eq!("bar", &s[3..]); @@ -314,7 +314,7 @@ fn test_simple_types() { assert_eq!(2.to_string(), "2"); assert_eq!(true.to_string(), "true"); assert_eq!(false.to_string(), "false"); - assert_eq!(("hi".to_string()).to_string(), "hi"); + assert_eq!(("hi".to_owned()).to_string(), "hi"); } #[test] @@ -329,7 +329,7 @@ fn test_vectors() { #[test] fn test_from_iterator() { - let s = "ศไทย中华Việt Nam".to_string(); + let s = "ศไทย中华Việt Nam".to_owned(); let t = "ศไทย中华"; let u = "Việt Nam"; @@ -367,7 +367,7 @@ fn test_drain() { #[test] fn test_extend_ref() { - let mut a = "foo".to_string(); + let mut a = "foo".to_owned(); a.extend(&['b', 'a', 'r']); assert_eq!(&a, "foobar"); diff --git a/src/libcore/any.rs b/src/libcore/any.rs index a65394f52682c..806244868bde9 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -61,7 +61,7 @@ //! } //! //! fn main() { -//! let my_string = "Hello World".to_string(); +//! let my_string = "Hello World".to_owned(); //! do_work(&my_string); //! //! let my_i8: i8 = 100; diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index f6987c1966493..6afc74068a320 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -41,7 +41,7 @@ use marker::Sized; /// let s = "hello"; /// is_hello(s); /// -/// let s = "hello".to_string(); +/// let s = "hello".to_owned(); /// is_hello(s); /// ``` #[stable(feature = "rust1", since = "1.0.0")] @@ -71,7 +71,7 @@ pub trait AsMut { /// assert_eq!(bytes, s.into()); /// } /// -/// let s = "hello".to_string(); +/// let s = "hello".to_owned(); /// is_hello(s); /// ``` #[stable(feature = "rust1", since = "1.0.0")] @@ -88,7 +88,7 @@ pub trait Into: Sized { /// `String` implements `From<&str>`: /// /// ``` -/// let string = "hello".to_string(); +/// let string = "hello".to_owned(); /// let other_string = String::from("hello"); /// /// assert_eq!(string, other_string); diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index ee1cab4076dc5..670ee7606ed13 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -780,7 +780,7 @@ impl<'a> Formatter<'a> { /// } /// /// // prints "Foo { bar: 10, baz: "Hello World" }" - /// println!("{:?}", Foo { bar: 10, baz: "Hello World".to_string() }); + /// println!("{:?}", Foo { bar: 10, baz: "Hello World".to_owned() }); /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] #[inline] @@ -808,7 +808,7 @@ impl<'a> Formatter<'a> { /// } /// /// // prints "Foo(10, "Hello World")" - /// println!("{:?}", Foo(10, "Hello World".to_string())); + /// println!("{:?}", Foo(10, "Hello World".to_owned())); /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] #[inline] @@ -883,7 +883,7 @@ impl<'a> Formatter<'a> { /// } /// /// // prints "{"A": 10, "B": 11}" - /// println!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])); + /// println!("{:?}", Foo(vec![("A".to_owned(), 10), ("B".to_owned(), 11)])); /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] #[inline] diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index 122fffc595905..b14f7430e882c 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -164,7 +164,7 @@ pub struct RadixFmt(T, R); /// ``` /// # #![feature(core)] /// use std::fmt::radix; -/// assert_eq!(format!("{}", radix(55, 36)), "1j".to_string()); +/// assert_eq!(format!("{}", radix(55, 36)), "1j".to_owned()); /// ``` #[unstable(feature = "core", reason = "may be renamed or move to a different module")] diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index e848a44e01ce0..5ef23eea615d9 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -26,8 +26,8 @@ //! phone: u64, //! } //! -//! 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 }; +//! 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 }; //! //! assert!(hash::<_, SipHasher>(&person1) != hash::<_, SipHasher>(&person2)); //! ``` @@ -52,8 +52,8 @@ //! } //! } //! -//! 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 }; +//! 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 }; //! //! assert_eq!(hash::<_, SipHasher>(&person1), hash::<_, SipHasher>(&person2)); //! ``` diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 872186c09e255..6e21562df81a3 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -233,7 +233,7 @@ impl Option { /// to the value inside the original. /// /// ``` - /// let num_as_str: Option = Some("10".to_string()); + /// let num_as_str: Option = Some("10".to_owned()); /// // First, cast `Option` to `Option<&String>` with `as_ref`, /// // then consume *that* with `map`, leaving `num_as_str` on the stack. /// let num_as_int: Option = num_as_str.as_ref().map(|n| n.len()); diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 003c4b2b78c5c..81f2ade9f52f9 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -494,7 +494,7 @@ impl Result { /// assert_eq!(x.map_err(stringify), Ok(2)); /// /// let x: Result = Err(13); - /// assert_eq!(x.map_err(stringify), Err("error code: 13".to_string())); + /// assert_eq!(x.map_err(stringify), Err("error code: 13".to_owned())); /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcoretest/mem.rs b/src/libcoretest/mem.rs index 5bc08376d257c..3ba24cce17100 100644 --- a/src/libcoretest/mem.rs +++ b/src/libcoretest/mem.rs @@ -79,7 +79,7 @@ fn test_swap() { #[test] fn test_replace() { - let mut x = Some("test".to_string()); + let mut x = Some("test".to_owned()); let y = replace(&mut x, None); assert!(x.is_none()); assert!(y.is_some()); @@ -103,7 +103,7 @@ fn test_transmute() { } unsafe { - assert_eq!(transmute::<_, Vec>("L".to_string()), [76]); + assert_eq!(transmute::<_, Vec>("L".to_owned()), [76]); } } diff --git a/src/libcoretest/nonzero.rs b/src/libcoretest/nonzero.rs index 7a367ddeec8d4..bfa43c8bd7c25 100644 --- a/src/libcoretest/nonzero.rs +++ b/src/libcoretest/nonzero.rs @@ -92,7 +92,7 @@ fn test_match_option_empty_string() { #[test] fn test_match_option_string() { - let five = "Five".to_string(); + let five = "Five".to_owned(); match Some(five) { Some(s) => assert_eq!(s, "Five"), None => panic!("unexpected None while matching on Some(String { ... })") diff --git a/src/libcoretest/option.rs b/src/libcoretest/option.rs index 66945ad251f1e..60239b9672f54 100644 --- a/src/libcoretest/option.rs +++ b/src/libcoretest/option.rs @@ -27,7 +27,7 @@ fn test_get_ptr() { #[test] fn test_get_str() { - let x = "test".to_string(); + let x = "test".to_owned(); let addr_x = x.as_ptr(); let opt = Some(x); let y = opt.unwrap(); @@ -133,7 +133,7 @@ fn test_or_else() { #[test] fn test_unwrap() { assert_eq!(Some(1).unwrap(), 1); - let s = Some("hello".to_string()).unwrap(); + let s = Some("hello".to_owned()).unwrap(); assert_eq!(s, "hello"); } diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 48649a3143464..9aaa17bfc06d8 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -453,7 +453,7 @@ pub fn optflag(short_name: &str, long_name: &str, desc: &str) -> OptGroup { OptGroup { short_name: short_name.to_string(), long_name: long_name.to_string(), - hint: "".to_string(), + hint: "".to_owned(), desc: desc.to_string(), hasarg: No, occur: Optional @@ -472,7 +472,7 @@ pub fn optflagmulti(short_name: &str, long_name: &str, desc: &str) -> OptGroup { OptGroup { short_name: short_name.to_string(), long_name: long_name.to_string(), - hint: "".to_string(), + hint: "".to_owned(), desc: desc.to_string(), hasarg: No, occur: Multi @@ -957,14 +957,14 @@ fn test_split_within() { } t("", 0, &[]); t("", 15, &[]); - t("hello", 15, &["hello".to_string()]); + t("hello", 15, &["hello".to_owned()]); t("\nMary had a little lamb\nLittle lamb\n", 15, &[ - "Mary had a".to_string(), - "little lamb".to_string(), - "Little lamb".to_string() + "Mary had a".to_owned(), + "little lamb".to_owned(), + "Little lamb".to_owned() ]); t("\nMary had a little lamb\nLittle lamb\n", ::std::usize::MAX, - &["Mary had a little lamb\nLittle lamb".to_string()]); + &["Mary had a little lamb\nLittle lamb".to_owned()]); } #[cfg(test)] @@ -978,7 +978,7 @@ mod tests { // Tests for reqopt #[test] fn test_reqopt() { - let long_args = vec!("--test=20".to_string()); + let long_args = vec!("--test=20".to_owned()); let opts = vec!(reqopt("t", "test", "testing", "TEST")); let rs = getopts(&long_args, &opts); match rs { @@ -990,7 +990,7 @@ mod tests { } _ => { panic!("test_reqopt failed (long arg)"); } } - let short_args = vec!("-t".to_string(), "20".to_string()); + let short_args = vec!("-t".to_owned(), "20".to_owned()); match getopts(&short_args, &opts) { Ok(ref m) => { assert!((m.opt_present("test"))); @@ -1004,7 +1004,7 @@ mod tests { #[test] fn test_reqopt_missing() { - let args = vec!("blah".to_string()); + let args = vec!("blah".to_owned()); let opts = vec!(reqopt("t", "test", "testing", "TEST")); let rs = getopts(&args, &opts); match rs { @@ -1015,14 +1015,14 @@ mod tests { #[test] fn test_reqopt_no_arg() { - let long_args = vec!("--test".to_string()); + let long_args = vec!("--test".to_owned()); let opts = vec!(reqopt("t", "test", "testing", "TEST")); let rs = getopts(&long_args, &opts); match rs { Err(ArgumentMissing(_)) => {}, _ => panic!() } - let short_args = vec!("-t".to_string()); + let short_args = vec!("-t".to_owned()); match getopts(&short_args, &opts) { Err(ArgumentMissing(_)) => {}, _ => panic!() @@ -1031,7 +1031,7 @@ mod tests { #[test] fn test_reqopt_multi() { - let args = vec!("--test=20".to_string(), "-t".to_string(), "30".to_string()); + let args = vec!("--test=20".to_owned(), "-t".to_owned(), "30".to_owned()); let opts = vec!(reqopt("t", "test", "testing", "TEST")); let rs = getopts(&args, &opts); match rs { @@ -1043,7 +1043,7 @@ mod tests { // Tests for optopt #[test] fn test_optopt() { - let long_args = vec!("--test=20".to_string()); + let long_args = vec!("--test=20".to_owned()); let opts = vec!(optopt("t", "test", "testing", "TEST")); let rs = getopts(&long_args, &opts); match rs { @@ -1055,7 +1055,7 @@ mod tests { } _ => panic!() } - let short_args = vec!("-t".to_string(), "20".to_string()); + let short_args = vec!("-t".to_owned(), "20".to_owned()); match getopts(&short_args, &opts) { Ok(ref m) => { assert!((m.opt_present("test"))); @@ -1069,7 +1069,7 @@ mod tests { #[test] fn test_optopt_missing() { - let args = vec!("blah".to_string()); + let args = vec!("blah".to_owned()); let opts = vec!(optopt("t", "test", "testing", "TEST")); let rs = getopts(&args, &opts); match rs { @@ -1083,14 +1083,14 @@ mod tests { #[test] fn test_optopt_no_arg() { - let long_args = vec!("--test".to_string()); + let long_args = vec!("--test".to_owned()); let opts = vec!(optopt("t", "test", "testing", "TEST")); let rs = getopts(&long_args, &opts); match rs { Err(ArgumentMissing(_)) => {}, _ => panic!() } - let short_args = vec!("-t".to_string()); + let short_args = vec!("-t".to_owned()); match getopts(&short_args, &opts) { Err(ArgumentMissing(_)) => {}, _ => panic!() @@ -1099,7 +1099,7 @@ mod tests { #[test] fn test_optopt_multi() { - let args = vec!("--test=20".to_string(), "-t".to_string(), "30".to_string()); + let args = vec!("--test=20".to_owned(), "-t".to_owned(), "30".to_owned()); let opts = vec!(optopt("t", "test", "testing", "TEST")); let rs = getopts(&args, &opts); match rs { @@ -1111,7 +1111,7 @@ mod tests { // Tests for optflag #[test] fn test_optflag() { - let long_args = vec!("--test".to_string()); + let long_args = vec!("--test".to_owned()); let opts = vec!(optflag("t", "test", "testing")); let rs = getopts(&long_args, &opts); match rs { @@ -1121,7 +1121,7 @@ mod tests { } _ => panic!() } - let short_args = vec!("-t".to_string()); + let short_args = vec!("-t".to_owned()); match getopts(&short_args, &opts) { Ok(ref m) => { assert!(m.opt_present("test")); @@ -1133,7 +1133,7 @@ mod tests { #[test] fn test_optflag_missing() { - let args = vec!("blah".to_string()); + let args = vec!("blah".to_owned()); let opts = vec!(optflag("t", "test", "testing")); let rs = getopts(&args, &opts); match rs { @@ -1147,7 +1147,7 @@ mod tests { #[test] fn test_optflag_long_arg() { - let args = vec!("--test=20".to_string()); + let args = vec!("--test=20".to_owned()); let opts = vec!(optflag("t", "test", "testing")); let rs = getopts(&args, &opts); match rs { @@ -1158,7 +1158,7 @@ mod tests { #[test] fn test_optflag_multi() { - let args = vec!("--test".to_string(), "-t".to_string()); + let args = vec!("--test".to_owned(), "-t".to_owned()); let opts = vec!(optflag("t", "test", "testing")); let rs = getopts(&args, &opts); match rs { @@ -1169,7 +1169,7 @@ mod tests { #[test] fn test_optflag_short_arg() { - let args = vec!("-t".to_string(), "20".to_string()); + let args = vec!("-t".to_owned(), "20".to_owned()); let opts = vec!(optflag("t", "test", "testing")); let rs = getopts(&args, &opts); match rs { @@ -1185,7 +1185,7 @@ mod tests { // Tests for optflagmulti #[test] fn test_optflagmulti_short1() { - let args = vec!("-v".to_string()); + let args = vec!("-v".to_owned()); let opts = vec!(optflagmulti("v", "verbose", "verbosity")); let rs = getopts(&args, &opts); match rs { @@ -1198,7 +1198,7 @@ mod tests { #[test] fn test_optflagmulti_short2a() { - let args = vec!("-v".to_string(), "-v".to_string()); + let args = vec!("-v".to_owned(), "-v".to_owned()); let opts = vec!(optflagmulti("v", "verbose", "verbosity")); let rs = getopts(&args, &opts); match rs { @@ -1211,7 +1211,7 @@ mod tests { #[test] fn test_optflagmulti_short2b() { - let args = vec!("-vv".to_string()); + let args = vec!("-vv".to_owned()); let opts = vec!(optflagmulti("v", "verbose", "verbosity")); let rs = getopts(&args, &opts); match rs { @@ -1224,7 +1224,7 @@ mod tests { #[test] fn test_optflagmulti_long1() { - let args = vec!("--verbose".to_string()); + let args = vec!("--verbose".to_owned()); let opts = vec!(optflagmulti("v", "verbose", "verbosity")); let rs = getopts(&args, &opts); match rs { @@ -1237,7 +1237,7 @@ mod tests { #[test] fn test_optflagmulti_long2() { - let args = vec!("--verbose".to_string(), "--verbose".to_string()); + let args = vec!("--verbose".to_owned(), "--verbose".to_owned()); let opts = vec!(optflagmulti("v", "verbose", "verbosity")); let rs = getopts(&args, &opts); match rs { @@ -1250,8 +1250,8 @@ mod tests { #[test] fn test_optflagmulti_mix() { - let args = vec!("--verbose".to_string(), "-v".to_string(), - "-vv".to_string(), "verbose".to_string()); + let args = vec!("--verbose".to_owned(), "-v".to_owned(), + "-vv".to_owned(), "verbose".to_owned()); let opts = vec!(optflagmulti("v", "verbose", "verbosity")); let rs = getopts(&args, &opts); match rs { @@ -1266,7 +1266,7 @@ mod tests { // Tests for optmulti #[test] fn test_optmulti() { - let long_args = vec!("--test=20".to_string()); + let long_args = vec!("--test=20".to_owned()); let opts = vec!(optmulti("t", "test", "testing", "TEST")); let rs = getopts(&long_args, &opts); match rs { @@ -1278,7 +1278,7 @@ mod tests { } _ => panic!() } - let short_args = vec!("-t".to_string(), "20".to_string()); + let short_args = vec!("-t".to_owned(), "20".to_owned()); match getopts(&short_args, &opts) { Ok(ref m) => { assert!((m.opt_present("test"))); @@ -1292,7 +1292,7 @@ mod tests { #[test] fn test_optmulti_missing() { - let args = vec!("blah".to_string()); + let args = vec!("blah".to_owned()); let opts = vec!(optmulti("t", "test", "testing", "TEST")); let rs = getopts(&args, &opts); match rs { @@ -1306,14 +1306,14 @@ mod tests { #[test] fn test_optmulti_no_arg() { - let long_args = vec!("--test".to_string()); + let long_args = vec!("--test".to_owned()); let opts = vec!(optmulti("t", "test", "testing", "TEST")); let rs = getopts(&long_args, &opts); match rs { Err(ArgumentMissing(_)) => {}, _ => panic!() } - let short_args = vec!("-t".to_string()); + let short_args = vec!("-t".to_owned()); match getopts(&short_args, &opts) { Err(ArgumentMissing(_)) => {}, _ => panic!() @@ -1322,7 +1322,7 @@ mod tests { #[test] fn test_optmulti_multi() { - let args = vec!("--test=20".to_string(), "-t".to_string(), "30".to_string()); + let args = vec!("--test=20".to_owned(), "-t".to_owned(), "30".to_owned()); let opts = vec!(optmulti("t", "test", "testing", "TEST")); let rs = getopts(&args, &opts); match rs { @@ -1341,14 +1341,14 @@ mod tests { #[test] fn test_unrecognized_option() { - let long_args = vec!("--untest".to_string()); + let long_args = vec!("--untest".to_owned()); let opts = vec!(optmulti("t", "test", "testing", "TEST")); let rs = getopts(&long_args, &opts); match rs { Err(UnrecognizedOption(_)) => {}, _ => panic!() } - let short_args = vec!("-u".to_string()); + let short_args = vec!("-u".to_owned()); match getopts(&short_args, &opts) { Err(UnrecognizedOption(_)) => {}, _ => panic!() @@ -1358,22 +1358,22 @@ mod tests { #[test] fn test_combined() { let args = - vec!("prog".to_string(), - "free1".to_string(), - "-s".to_string(), - "20".to_string(), - "free2".to_string(), - "--flag".to_string(), - "--long=30".to_string(), - "-f".to_string(), - "-m".to_string(), - "40".to_string(), - "-m".to_string(), - "50".to_string(), - "-n".to_string(), - "-A B".to_string(), - "-n".to_string(), - "-60 70".to_string()); + vec!("prog".to_owned(), + "free1".to_owned(), + "-s".to_owned(), + "20".to_owned(), + "free2".to_owned(), + "--flag".to_owned(), + "--long=30".to_owned(), + "-f".to_owned(), + "-m".to_owned(), + "40".to_owned(), + "-m".to_owned(), + "50".to_owned(), + "-n".to_owned(), + "-A B".to_owned(), + "-n".to_owned(), + "-60 70".to_owned()); let opts = vec!(optopt("s", "something", "something", "SOMETHING"), optflag("", "flag", "a flag"), @@ -1410,81 +1410,81 @@ mod tests { optopt("", "encrypt", "encrypt", "ENCRYPT"), optopt("f", "", "flag", "FLAG")); - let args_single = vec!("-e".to_string(), "foo".to_string()); + let args_single = vec!("-e".to_owned(), "foo".to_owned()); let matches_single = &match getopts(&args_single, &opts) { result::Result::Ok(m) => m, result::Result::Err(_) => panic!() }; - assert!(matches_single.opts_present(&["e".to_string()])); - assert!(matches_single.opts_present(&["encrypt".to_string(), "e".to_string()])); - assert!(matches_single.opts_present(&["e".to_string(), "encrypt".to_string()])); - assert!(!matches_single.opts_present(&["encrypt".to_string()])); - assert!(!matches_single.opts_present(&["thing".to_string()])); + assert!(matches_single.opts_present(&["e".to_owned()])); + assert!(matches_single.opts_present(&["encrypt".to_owned(), "e".to_owned()])); + assert!(matches_single.opts_present(&["e".to_owned(), "encrypt".to_owned()])); + assert!(!matches_single.opts_present(&["encrypt".to_owned()])); + assert!(!matches_single.opts_present(&["thing".to_owned()])); assert!(!matches_single.opts_present(&[])); - assert_eq!(matches_single.opts_str(&["e".to_string()]).unwrap(), "foo"); - assert_eq!(matches_single.opts_str(&["e".to_string(), "encrypt".to_string()]).unwrap(), + assert_eq!(matches_single.opts_str(&["e".to_owned()]).unwrap(), "foo"); + assert_eq!(matches_single.opts_str(&["e".to_owned(), "encrypt".to_owned()]).unwrap(), "foo"); - assert_eq!(matches_single.opts_str(&["encrypt".to_string(), "e".to_string()]).unwrap(), + assert_eq!(matches_single.opts_str(&["encrypt".to_owned(), "e".to_owned()]).unwrap(), "foo"); - let args_both = vec!("-e".to_string(), "foo".to_string(), "--encrypt".to_string(), - "foo".to_string()); + let args_both = vec!("-e".to_owned(), "foo".to_owned(), "--encrypt".to_owned(), + "foo".to_owned()); let matches_both = &match getopts(&args_both, &opts) { result::Result::Ok(m) => m, result::Result::Err(_) => panic!() }; - assert!(matches_both.opts_present(&["e".to_string()])); - assert!(matches_both.opts_present(&["encrypt".to_string()])); - assert!(matches_both.opts_present(&["encrypt".to_string(), "e".to_string()])); - assert!(matches_both.opts_present(&["e".to_string(), "encrypt".to_string()])); - assert!(!matches_both.opts_present(&["f".to_string()])); - assert!(!matches_both.opts_present(&["thing".to_string()])); + assert!(matches_both.opts_present(&["e".to_owned()])); + assert!(matches_both.opts_present(&["encrypt".to_owned()])); + assert!(matches_both.opts_present(&["encrypt".to_owned(), "e".to_owned()])); + assert!(matches_both.opts_present(&["e".to_owned(), "encrypt".to_owned()])); + assert!(!matches_both.opts_present(&["f".to_owned()])); + assert!(!matches_both.opts_present(&["thing".to_owned()])); assert!(!matches_both.opts_present(&[])); - assert_eq!(matches_both.opts_str(&["e".to_string()]).unwrap(), "foo"); - assert_eq!(matches_both.opts_str(&["encrypt".to_string()]).unwrap(), "foo"); - assert_eq!(matches_both.opts_str(&["e".to_string(), "encrypt".to_string()]).unwrap(), + assert_eq!(matches_both.opts_str(&["e".to_owned()]).unwrap(), "foo"); + assert_eq!(matches_both.opts_str(&["encrypt".to_owned()]).unwrap(), "foo"); + assert_eq!(matches_both.opts_str(&["e".to_owned(), "encrypt".to_owned()]).unwrap(), "foo"); - assert_eq!(matches_both.opts_str(&["encrypt".to_string(), "e".to_string()]).unwrap(), + assert_eq!(matches_both.opts_str(&["encrypt".to_owned(), "e".to_owned()]).unwrap(), "foo"); } #[test] fn test_nospace() { - let args = vec!("-Lfoo".to_string(), "-M.".to_string()); + let args = vec!("-Lfoo".to_owned(), "-M.".to_owned()); let opts = vec!(optmulti("L", "", "library directory", "LIB"), optmulti("M", "", "something", "MMMM")); let matches = &match getopts(&args, &opts) { result::Result::Ok(m) => m, result::Result::Err(_) => panic!() }; - assert!(matches.opts_present(&["L".to_string()])); - assert_eq!(matches.opts_str(&["L".to_string()]).unwrap(), "foo"); - assert!(matches.opts_present(&["M".to_string()])); - assert_eq!(matches.opts_str(&["M".to_string()]).unwrap(), "."); + assert!(matches.opts_present(&["L".to_owned()])); + assert_eq!(matches.opts_str(&["L".to_owned()]).unwrap(), "foo"); + assert!(matches.opts_present(&["M".to_owned()])); + assert_eq!(matches.opts_str(&["M".to_owned()]).unwrap(), "."); } #[test] fn test_nospace_conflict() { - let args = vec!("-vvLverbose".to_string(), "-v".to_string() ); + let args = vec!("-vvLverbose".to_owned(), "-v".to_owned() ); let opts = vec!(optmulti("L", "", "library directory", "LIB"), optflagmulti("v", "verbose", "Verbose")); let matches = &match getopts(&args, &opts) { result::Result::Ok(m) => m, result::Result::Err(e) => panic!( "{}", e ) }; - assert!(matches.opts_present(&["L".to_string()])); - assert_eq!(matches.opts_str(&["L".to_string()]).unwrap(), "verbose"); - assert!(matches.opts_present(&["v".to_string()])); + assert!(matches.opts_present(&["L".to_owned()])); + assert_eq!(matches.opts_str(&["L".to_owned()]).unwrap(), "verbose"); + assert!(matches.opts_present(&["v".to_owned()])); assert_eq!(3, matches.opt_count("v")); } #[test] fn test_long_to_short() { let mut short = Opt { - name: Name::Long("banana".to_string()), + name: Name::Long("banana".to_owned()), hasarg: HasArg::Yes, occur: Occur::Req, aliases: Vec::new(), @@ -1503,7 +1503,7 @@ mod tests { let opts = vec!( optflagmulti("a", "apple", "Desc")); - let args = vec!("-a".to_string(), "--apple".to_string(), "-a".to_string()); + let args = vec!("-a".to_owned(), "--apple".to_owned(), "-a".to_owned()); let matches = getopts(&args, &opts).unwrap(); assert_eq!(3, matches.opt_count("a")); @@ -1602,7 +1602,7 @@ Options: optflagopt("p", "", "Desc", "VAL"), optmulti("l", "", "Desc", "VAL")); - let expected = "Usage: fruits -b VAL [-a VAL] [-k] [-p [VAL]] [-l VAL]..".to_string(); + let expected = "Usage: fruits -b VAL [-a VAL] [-k] [-p [VAL]] [-l VAL]..".to_owned(); let generated_usage = short_usage("fruits", &optgroups); debug!("expected: <<{}>>", expected); diff --git a/src/liblog/directive.rs b/src/liblog/directive.rs index 5d38a381e6b7e..9fca95f01993a 100644 --- a/src/liblog/directive.rs +++ b/src/liblog/directive.rs @@ -90,13 +90,13 @@ mod tests { fn parse_logging_spec_valid() { let (dirs, filter) = parse_logging_spec("crate1::mod1=1,crate1::mod2,crate2=4"); assert_eq!(dirs.len(), 3); - assert_eq!(dirs[0].name, Some("crate1::mod1".to_string())); + assert_eq!(dirs[0].name, Some("crate1::mod1".to_owned())); assert_eq!(dirs[0].level, 1); - assert_eq!(dirs[1].name, Some("crate1::mod2".to_string())); + assert_eq!(dirs[1].name, Some("crate1::mod2".to_owned())); assert_eq!(dirs[1].level, ::MAX_LOG_LEVEL); - assert_eq!(dirs[2].name, Some("crate2".to_string())); + assert_eq!(dirs[2].name, Some("crate2".to_owned())); assert_eq!(dirs[2].level, 4); assert!(filter.is_none()); } @@ -106,7 +106,7 @@ mod tests { // test parse_logging_spec with multiple = in specification let (dirs, filter) = parse_logging_spec("crate1::mod1=1=2,crate2=4"); assert_eq!(dirs.len(), 1); - assert_eq!(dirs[0].name, Some("crate2".to_string())); + assert_eq!(dirs[0].name, Some("crate2".to_owned())); assert_eq!(dirs[0].level, 4); assert!(filter.is_none()); } @@ -116,7 +116,7 @@ mod tests { // test parse_logging_spec with 'noNumber' as log level let (dirs, filter) = parse_logging_spec("crate1::mod1=noNumber,crate2=4"); assert_eq!(dirs.len(), 1); - assert_eq!(dirs[0].name, Some("crate2".to_string())); + assert_eq!(dirs[0].name, Some("crate2".to_owned())); assert_eq!(dirs[0].level, 4); assert!(filter.is_none()); } @@ -126,7 +126,7 @@ mod tests { // test parse_logging_spec with 'warn' as log level let (dirs, filter) = parse_logging_spec("crate1::mod1=wrong,crate2=warn"); assert_eq!(dirs.len(), 1); - assert_eq!(dirs[0].name, Some("crate2".to_string())); + assert_eq!(dirs[0].name, Some("crate2".to_owned())); assert_eq!(dirs[0].level, ::WARN); assert!(filter.is_none()); } @@ -136,7 +136,7 @@ mod tests { // test parse_logging_spec with '' as log level let (dirs, filter) = parse_logging_spec("crate1::mod1=wrong,crate2="); assert_eq!(dirs.len(), 1); - assert_eq!(dirs[0].name, Some("crate2".to_string())); + assert_eq!(dirs[0].name, Some("crate2".to_owned())); assert_eq!(dirs[0].level, ::MAX_LOG_LEVEL); assert!(filter.is_none()); } @@ -148,7 +148,7 @@ mod tests { assert_eq!(dirs.len(), 2); assert_eq!(dirs[0].name, None); assert_eq!(dirs[0].level, 2); - assert_eq!(dirs[1].name, Some("crate2".to_string())); + assert_eq!(dirs[1].name, Some("crate2".to_owned())); assert_eq!(dirs[1].level, 4); assert!(filter.is_none()); } @@ -157,13 +157,13 @@ mod tests { fn parse_logging_spec_valid_filter() { let (dirs, filter) = parse_logging_spec("crate1::mod1=1,crate1::mod2,crate2=4/abc"); assert_eq!(dirs.len(), 3); - assert_eq!(dirs[0].name, Some("crate1::mod1".to_string())); + assert_eq!(dirs[0].name, Some("crate1::mod1".to_owned())); assert_eq!(dirs[0].level, 1); - assert_eq!(dirs[1].name, Some("crate1::mod2".to_string())); + assert_eq!(dirs[1].name, Some("crate1::mod2".to_owned())); assert_eq!(dirs[1].level, ::MAX_LOG_LEVEL); - assert_eq!(dirs[2].name, Some("crate2".to_string())); + assert_eq!(dirs[2].name, Some("crate2".to_owned())); assert_eq!(dirs[2].level, 4); assert!(filter.is_some() && filter.unwrap().to_string() == "abc"); } @@ -172,7 +172,7 @@ mod tests { fn parse_logging_spec_invalid_crate_filter() { let (dirs, filter) = parse_logging_spec("crate1::mod1=1=2,crate2=4/a.c"); assert_eq!(dirs.len(), 1); - assert_eq!(dirs[0].name, Some("crate2".to_string())); + assert_eq!(dirs[0].name, Some("crate2".to_owned())); assert_eq!(dirs[0].level, 4); assert!(filter.is_some() && filter.unwrap().to_string() == "a.c"); } @@ -181,7 +181,7 @@ mod tests { fn parse_logging_spec_empty_with_filter() { let (dirs, filter) = parse_logging_spec("crate1/a*c"); assert_eq!(dirs.len(), 1); - assert_eq!(dirs[0].name, Some("crate1".to_string())); + assert_eq!(dirs[0].name, Some("crate1".to_owned())); assert_eq!(dirs[0].level, ::MAX_LOG_LEVEL); assert!(filter.is_some() && filter.unwrap().to_string() == "a*c"); } diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 15767024ba80f..4d236beae9dc2 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -466,11 +466,11 @@ mod tests { fn match_full_path() { let dirs = [ LogDirective { - name: Some("crate2".to_string()), + name: Some("crate2".to_owned()), level: 3 }, LogDirective { - name: Some("crate1::mod1".to_string()), + name: Some("crate1::mod1".to_owned()), level: 2 } ]; @@ -483,8 +483,8 @@ mod tests { #[test] fn no_match() { let dirs = [ - LogDirective { name: Some("crate2".to_string()), level: 3 }, - LogDirective { name: Some("crate1::mod1".to_string()), level: 2 } + LogDirective { name: Some("crate2".to_owned()), level: 3 }, + LogDirective { name: Some("crate1::mod1".to_owned()), level: 2 } ]; assert!(!enabled(2, "crate3", dirs.iter())); } @@ -492,8 +492,8 @@ mod tests { #[test] fn match_beginning() { let dirs = [ - LogDirective { name: Some("crate2".to_string()), level: 3 }, - LogDirective { name: Some("crate1::mod1".to_string()), level: 2 } + LogDirective { name: Some("crate2".to_owned()), level: 3 }, + LogDirective { name: Some("crate1::mod1".to_owned()), level: 2 } ]; assert!(enabled(3, "crate2::mod1", dirs.iter())); } @@ -501,9 +501,9 @@ mod tests { #[test] fn match_beginning_longest_match() { let dirs = [ - LogDirective { name: Some("crate2".to_string()), level: 3 }, - LogDirective { name: Some("crate2::mod".to_string()), level: 4 }, - LogDirective { name: Some("crate1::mod1".to_string()), level: 2 } + LogDirective { name: Some("crate2".to_owned()), level: 3 }, + LogDirective { name: Some("crate2::mod".to_owned()), level: 4 }, + LogDirective { name: Some("crate1::mod1".to_owned()), level: 2 } ]; assert!(enabled(4, "crate2::mod1", dirs.iter())); assert!(!enabled(4, "crate2", dirs.iter())); @@ -513,7 +513,7 @@ mod tests { fn match_default() { let dirs = [ LogDirective { name: None, level: 3 }, - LogDirective { name: Some("crate1::mod1".to_string()), level: 2 } + LogDirective { name: Some("crate1::mod1".to_owned()), level: 2 } ]; assert!(enabled(2, "crate1::mod1", dirs.iter())); assert!(enabled(3, "crate2::mod2", dirs.iter())); @@ -523,7 +523,7 @@ mod tests { fn zero_level() { let dirs = [ LogDirective { name: None, level: 3 }, - LogDirective { name: Some("crate1::mod1".to_string()), level: 0 } + LogDirective { name: Some("crate1::mod1".to_owned()), level: 0 } ]; assert!(!enabled(1, "crate1::mod1", dirs.iter())); assert!(enabled(3, "crate2::mod2", dirs.iter())); diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 9a60e2378cca6..f335a40d264f5 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -76,7 +76,7 @@ into a variable called `op_string` while simultaneously requiring the inner String to be moved into a variable called `s`. ``` -let x = Some("s".to_string()); +let x = Some("s".to_owned()); match x { op_string @ Some(s) => ... None => ... @@ -93,7 +93,7 @@ referenced in the pattern guard code. Doing so however would prevent the name from being available in the body of the match arm. Consider the following: ``` -match Some("hi".to_string()) { +match Some("hi".to_owned()) { Some(s) if s.len() == 0 => // use s. ... } @@ -107,7 +107,7 @@ innocuous, the problem is most clear when considering functions that take their argument by value. ``` -match Some("hi".to_string()) { +match Some("hi".to_owned()) { Some(s) if { drop(s); false } => (), Some(s) => // use s. ... @@ -815,7 +815,7 @@ match Some(5) { } // After. -match Some("hi".to_string()) { +match Some("hi".to_owned()) { Some(ref s) => { let op_string_ref = &Some(&s); ... diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index 311ab1cbd0ce0..0f2d393e3011f 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -280,26 +280,26 @@ fn find_libdir(sysroot: &Path) -> String { #[cfg(target_pointer_width = "64")] fn primary_libdir_name() -> String { - "lib64".to_string() + "lib64".to_owned() } #[cfg(target_pointer_width = "32")] fn primary_libdir_name() -> String { - "lib32".to_string() + "lib32".to_owned() } fn secondary_libdir_name() -> String { - "lib".to_string() + "lib".to_owned() } } #[cfg(windows)] fn find_libdir(_sysroot: &Path) -> String { - "bin".to_string() + "bin".to_owned() } // The name of rustc's own place to organize libraries. // Used to be "rustc", now the default is "rustlib" pub fn rustlibdir() -> String { - "rustlib".to_string() + "rustlib".to_owned() } diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index 5f1e30ae63a19..f0f2b0b8b9faa 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -418,7 +418,7 @@ impl<'a> Context<'a> { file.ends_with(".a") { staticlibs.push(CrateMismatch { path: path.to_path_buf(), - got: "static".to_string() + got: "static".to_owned() }); } return FileDoesntMatch diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index 1d5d4f72fc2da..8b7cd8575f85c 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -133,21 +133,21 @@ impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O let gens_str = if gens.iter().any(|&u| u != 0) { format!(" gen: {}", bits_to_string(gens)) } else { - "".to_string() + "".to_owned() }; let action_kills = &self.action_kills[start .. end]; let action_kills_str = if action_kills.iter().any(|&u| u != 0) { format!(" action_kill: {}", bits_to_string(action_kills)) } else { - "".to_string() + "".to_owned() }; let scope_kills = &self.scope_kills[start .. end]; let scope_kills_str = if scope_kills.iter().any(|&u| u != 0) { format!(" scope_kill: {}", bits_to_string(scope_kills)) } else { - "".to_string() + "".to_owned() }; try!(ps.synth_comment( diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs index c9a863c096352..3526519fd8657 100644 --- a/src/librustc/middle/infer/error_reporting.rs +++ b/src/librustc/middle/infer/error_reporting.rs @@ -1442,11 +1442,11 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx> { fn report_inference_failure(&self, var_origin: RegionVariableOrigin) { let var_description = match var_origin { - infer::MiscVariable(_) => "".to_string(), - infer::PatternRegion(_) => " for pattern".to_string(), - infer::AddrOfRegion(_) => " for borrow expression".to_string(), - infer::Autoref(_) => " for autoref".to_string(), - infer::Coercion(_) => " for automatic coercion".to_string(), + infer::MiscVariable(_) => "".to_owned(), + infer::PatternRegion(_) => " for pattern".to_owned(), + infer::AddrOfRegion(_) => " for borrow expression".to_owned(), + infer::Autoref(_) => " for autoref".to_owned(), + infer::Coercion(_) => " for automatic coercion".to_owned(), infer::LateBoundRegion(_, br, infer::FnCall) => { format!(" for {}in function call", bound_region_to_string(self.tcx, "lifetime parameter ", true, br)) diff --git a/src/librustc/middle/infer/mod.rs b/src/librustc/middle/infer/mod.rs index b802f46e28594..afc3d1702bc40 100644 --- a/src/librustc/middle/infer/mod.rs +++ b/src/librustc/middle/infer/mod.rs @@ -302,13 +302,13 @@ pub fn fixup_err_to_string(f: fixup_err) -> String { match f { unresolved_int_ty(_) => { "cannot determine the type of this integer; add a suffix to \ - specify the type explicitly".to_string() + specify the type explicitly".to_owned() } unresolved_float_ty(_) => { "cannot determine the type of this number; add a suffix to specify \ - the type explicitly".to_string() + the type explicitly".to_owned() } - unresolved_ty(_) => "unconstrained type".to_string(), + unresolved_ty(_) => "unconstrained type".to_owned(), } } @@ -981,7 +981,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { match resolved_expected { Some(t) if ty::type_is_error(t) => (), _ => { - let error_str = err.map_or("".to_string(), |t_err| { + let error_str = err.map_or("".to_owned(), |t_err| { format!(" ({})", ty::type_err_to_str(self.tcx, t_err)) }); diff --git a/src/librustc/middle/infer/region_inference/graphviz.rs b/src/librustc/middle/infer/region_inference/graphviz.rs index 5a06a5193bf1c..9b86f9bebf17a 100644 --- a/src/librustc/middle/infer/region_inference/graphviz.rs +++ b/src/librustc/middle/infer/region_inference/graphviz.rs @@ -85,7 +85,7 @@ pub fn maybe_print_constraints_for<'a, 'tcx>(region_vars: &RegionVarBindings<'a, } Ok(other_path) => other_path, - Err(_) => "/tmp/constraints.node%.dot".to_string(), + Err(_) => "/tmp/constraints.node%.dot".to_owned(), }; if output_template.is_empty() { diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index d4136637e585c..2efae09f85a3a 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -179,7 +179,7 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, cx: &ty::ctxt) -> String { VarDefNode(s) => { format!("Var def node [{}]", cm.span_to_string(s)) } - ExitNode => "Exit node".to_string(), + ExitNode => "Exit node".to_owned(), } } @@ -337,8 +337,8 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> { Local(LocalInfo { name, .. }) | Arg(_, name) => { token::get_name(name).to_string() }, - ImplicitRet => "".to_string(), - CleanExit => "".to_string() + ImplicitRet => "".to_owned(), + CleanExit => "".to_owned() } } diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 3fff15049930b..054765fd3b24f 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -1517,17 +1517,17 @@ impl<'tcx> cmt_<'tcx> { pub fn descriptive_string(&self, tcx: &ty::ctxt) -> String { match self.cat { cat_static_item => { - "static item".to_string() + "static item".to_owned() } cat_rvalue(..) => { - "non-lvalue".to_string() + "non-lvalue".to_owned() } cat_local(vid) => { match tcx.map.find(vid) { Some(ast_map::NodeArg(_)) => { - "argument".to_string() + "argument".to_owned() } - _ => "local variable".to_string() + _ => "local variable".to_owned() } } cat_deref(_, _, pk) => { @@ -1556,22 +1556,22 @@ impl<'tcx> cmt_<'tcx> { } } cat_interior(_, InteriorField(NamedField(_))) => { - "field".to_string() + "field".to_owned() } cat_interior(_, InteriorField(PositionalField(_))) => { - "anonymous field".to_string() + "anonymous field".to_owned() } cat_interior(_, InteriorElement(InteriorOffsetKind::Index, VecElement)) | cat_interior(_, InteriorElement(InteriorOffsetKind::Index, OtherElement)) => { - "indexed content".to_string() + "indexed content".to_owned() } cat_interior(_, InteriorElement(InteriorOffsetKind::Pattern, VecElement)) | cat_interior(_, InteriorElement(InteriorOffsetKind::Pattern, OtherElement)) => { - "pattern-bound indexed content".to_string() + "pattern-bound indexed content".to_owned() } cat_upvar(ref var) => { var.user_string(tcx) @@ -1660,7 +1660,7 @@ impl<'tcx> Repr<'tcx> for InteriorKind { token::get_name(fld).to_string() } InteriorField(PositionalField(i)) => format!("#{}", i), - InteriorElement(..) => "[]".to_string(), + InteriorElement(..) => "[]".to_owned(), } } } diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index b29e40d2d5ec6..c1837f44330d0 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -620,6 +620,6 @@ pub fn check_unused_or_stable_features(sess: &Session, sess.add_lint(lint::builtin::UNUSED_FEATURES, ast::CRATE_NODE_ID, span, - "unused or unknown feature".to_string()); + "unused or unknown feature".to_owned()); } } diff --git a/src/librustc/middle/traits/error_reporting.rs b/src/librustc/middle/traits/error_reporting.rs index 2b82987480d6e..07243e3b15fd8 100644 --- a/src/librustc/middle/traits/error_reporting.rs +++ b/src/librustc/middle/traits/error_reporting.rs @@ -95,7 +95,7 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, trait_ref.substs.types.get(param, i) .user_string(infcx.tcx)) }).collect::>(); - generic_map.insert("Self".to_string(), + generic_map.insert("Self".to_owned(), trait_ref.self_ty().user_string(infcx.tcx)); let parser = Parser::new(&istring); let mut errored = false; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 0b014c9e6a20c..b3690752026d7 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -5011,36 +5011,36 @@ pub fn ty_sort_string<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> String { ty_tup(ref tys) if tys.is_empty() => ::util::ppaux::ty_to_string(cx, ty), ty_enum(id, _) => format!("enum `{}`", item_path_str(cx, id)), - ty_uniq(_) => "box".to_string(), + ty_uniq(_) => "box".to_owned(), ty_vec(_, Some(n)) => format!("array of {} elements", n), - ty_vec(_, None) => "slice".to_string(), - ty_ptr(_) => "*-ptr".to_string(), - ty_rptr(_, _) => "&-ptr".to_string(), + ty_vec(_, None) => "slice".to_owned(), + ty_ptr(_) => "*-ptr".to_owned(), + ty_rptr(_, _) => "&-ptr".to_owned(), ty_bare_fn(Some(_), _) => format!("fn item"), - ty_bare_fn(None, _) => "fn pointer".to_string(), + ty_bare_fn(None, _) => "fn pointer".to_owned(), ty_trait(ref inner) => { format!("trait {}", item_path_str(cx, inner.principal_def_id())) } ty_struct(id, _) => { format!("struct `{}`", item_path_str(cx, id)) } - ty_closure(..) => "closure".to_string(), - ty_tup(_) => "tuple".to_string(), - ty_infer(TyVar(_)) => "inferred type".to_string(), - ty_infer(IntVar(_)) => "integral variable".to_string(), - ty_infer(FloatVar(_)) => "floating-point variable".to_string(), - ty_infer(FreshTy(_)) => "skolemized type".to_string(), - ty_infer(FreshIntTy(_)) => "skolemized integral type".to_string(), - ty_infer(FreshFloatTy(_)) => "skolemized floating-point type".to_string(), - ty_projection(_) => "associated type".to_string(), + ty_closure(..) => "closure".to_owned(), + ty_tup(_) => "tuple".to_owned(), + ty_infer(TyVar(_)) => "inferred type".to_owned(), + ty_infer(IntVar(_)) => "integral variable".to_owned(), + ty_infer(FloatVar(_)) => "floating-point variable".to_owned(), + ty_infer(FreshTy(_)) => "skolemized type".to_owned(), + ty_infer(FreshIntTy(_)) => "skolemized integral type".to_owned(), + ty_infer(FreshFloatTy(_)) => "skolemized floating-point type".to_owned(), + ty_projection(_) => "associated type".to_owned(), ty_param(ref p) => { if p.space == subst::SelfSpace { - "Self".to_string() + "Self".to_owned() } else { - "type parameter".to_string() + "type parameter".to_owned() } } - ty_err => "type error".to_string(), + ty_err => "type error".to_owned(), } } @@ -5056,8 +5056,8 @@ impl<'tcx> Repr<'tcx> for ty::type_err<'tcx> { /// errors. pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String { match *err { - terr_cyclic_ty => "cyclic type of infinite size".to_string(), - terr_mismatch => "types differ".to_string(), + terr_cyclic_ty => "cyclic type of infinite size".to_owned(), + terr_mismatch => "types differ".to_owned(), terr_unsafety_mismatch(values) => { format!("expected {} fn, found {} fn", values.expected, @@ -5068,13 +5068,13 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String { values.expected, values.found) } - terr_mutability => "values differ in mutability".to_string(), + terr_mutability => "values differ in mutability".to_owned(), terr_box_mutability => { - "boxed values differ in mutability".to_string() + "boxed values differ in mutability".to_owned() } - terr_vec_mutability => "vectors differ in mutability".to_string(), - terr_ptr_mutability => "pointers differ in mutability".to_string(), - terr_ref_mutability => "references differ in mutability".to_string(), + terr_vec_mutability => "vectors differ in mutability".to_owned(), + terr_ptr_mutability => "pointers differ in mutability".to_owned(), + terr_ref_mutability => "references differ in mutability".to_owned(), terr_ty_param_size(values) => { format!("expected a type with {} type params, \ found one with {} type params", @@ -5094,16 +5094,16 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String { values.found) } terr_arg_count => { - "incorrect number of function parameters".to_string() + "incorrect number of function parameters".to_owned() } terr_regions_does_not_outlive(..) => { - "lifetime mismatch".to_string() + "lifetime mismatch".to_owned() } terr_regions_not_same(..) => { - "lifetimes are not the same".to_string() + "lifetimes are not the same".to_owned() } terr_regions_no_overlap(..) => { - "lifetimes do not intersect".to_string() + "lifetimes do not intersect".to_owned() } terr_regions_insufficiently_polymorphic(br, _) => { format!("expected bound lifetime parameter {}, \ @@ -5145,7 +5145,7 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String { } } terr_integer_as_char => { - "expected an integral type, found `char`".to_string() + "expected an integral type, found `char`".to_owned() } terr_int_mismatch(ref values) => { format!("expected `{:?}`, found `{:?}`", diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 48fe574e71f48..60586e2ab4dc5 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -153,7 +153,7 @@ impl Input { match *self { Input::File(ref ifile) => ifile.file_stem().unwrap() .to_str().unwrap().to_string(), - Input::Str(_) => "rust_out".to_string(), + Input::Str(_) => "rust_out".to_owned(), } } } @@ -486,7 +486,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, "perform LLVM link-time optimizations"), target_cpu: Option = (None, parse_opt_string, "select target processor (llc -mcpu=help for details)"), - target_feature: String = ("".to_string(), parse_string, + target_feature: String = ("".to_owned(), parse_string, "target specific attributes (llc -mattr=help for details)"), passes: Vec = (Vec::new(), parse_list, "a list of extra LLVM passes to run (space separated)"), @@ -516,7 +516,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, "choose the code model to use (llc -code-model for details)"), metadata: Vec = (Vec::new(), parse_list, "metadata to mangle symbol names with"), - extra_filename: String = ("".to_string(), parse_string, + extra_filename: String = ("".to_owned(), parse_string, "extra data to put in each output filename"), codegen_units: usize = (1, parse_uint, "divide crate into N units to optimize in parallel"), @@ -849,7 +849,7 @@ pub fn rustc_optgroups() -> Vec { // Convert strings provided as --cfg [cfgspec] into a crate_cfg pub fn parse_cfgspecs(cfgspecs: Vec ) -> ast::CrateConfig { cfgspecs.into_iter().map(|s| { - parse::parse_meta_from_source_str("cfgspec".to_string(), + parse::parse_meta_from_source_str("cfgspec".to_owned(), s.to_string(), Vec::new(), &parse::ParseSess::new()) @@ -1129,7 +1129,7 @@ mod tests { #[test] fn test_switch_implies_cfg_test() { let matches = - &match getopts(&["--test".to_string()], &optgroups()) { + &match getopts(&["--test".to_owned()], &optgroups()) { Ok(m) => m, Err(f) => panic!("test_switch_implies_cfg_test: {}", f) }; @@ -1145,7 +1145,7 @@ mod tests { #[test] fn test_switch_implies_cfg_test_unless_cfg_test() { let matches = - &match getopts(&["--test".to_string(), "--cfg=test".to_string()], + &match getopts(&["--test".to_owned(), "--cfg=test".to_owned()], &optgroups()) { Ok(m) => m, Err(f) => { @@ -1165,7 +1165,7 @@ mod tests { fn test_can_print_warnings() { { let matches = getopts(&[ - "-Awarnings".to_string() + "-Awarnings".to_owned() ], &optgroups()).unwrap(); let registry = diagnostics::registry::Registry::new(&[]); let sessopts = build_session_options(&matches); @@ -1175,8 +1175,8 @@ mod tests { { let matches = getopts(&[ - "-Awarnings".to_string(), - "-Dwarnings".to_string() + "-Awarnings".to_owned(), + "-Dwarnings".to_owned() ], &optgroups()).unwrap(); let registry = diagnostics::registry::Registry::new(&[]); let sessopts = build_session_options(&matches); @@ -1186,7 +1186,7 @@ mod tests { { let matches = getopts(&[ - "-Adead_code".to_string() + "-Adead_code".to_owned() ], &optgroups()).unwrap(); let registry = diagnostics::registry::Registry::new(&[]); let sessopts = build_session_options(&matches); diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index acbd09f671ba1..21476ab081952 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -135,7 +135,7 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region) BrAnon(idx) => { format!("the anonymous lifetime #{} defined on", idx + 1) } - BrFresh(_) => "an anonymous lifetime defined on".to_string(), + BrFresh(_) => "an anonymous lifetime defined on".to_owned(), _ => { format!("the lifetime {} as defined on", bound_region_ptr_to_string(cx, fr.bound_region)) @@ -159,9 +159,9 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region) } } - ReStatic => { ("the static lifetime".to_string(), None) } + ReStatic => { ("the static lifetime".to_owned(), None) } - ReEmpty => { ("the empty lifetime".to_string(), None) } + ReEmpty => { ("the empty lifetime".to_owned(), None) } ReEarlyBound(ref data) => { (format!("{}", token::get_name(data.name)), None) @@ -239,8 +239,8 @@ pub fn region_to_string(cx: &ctxt, prefix: &str, space: bool, region: Region) -> pub fn mutability_to_string(m: ast::Mutability) -> String { match m { - ast::MutMutable => "mut ".to_string(), - ast::MutImmutable => "".to_string(), + ast::MutMutable => "mut ".to_owned(), + ast::MutImmutable => "".to_owned(), } } @@ -363,8 +363,8 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String { // pretty print the structural type representation: match typ.sty { - ty_bool => "bool".to_string(), - ty_char => "char".to_string(), + ty_bool => "bool".to_owned(), + ty_char => "char".to_owned(), ty_int(t) => ast_util::int_ty_to_string(t, None).to_string(), ty_uint(t) => ast_util::uint_ty_to_string(t, None).to_string(), ty_float(t) => ast_util::float_ty_to_string(t).to_string(), @@ -394,7 +394,7 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String { bare_fn_to_string(cx, opt_def_id, f.unsafety, f.abi, None, &f.sig) } ty_infer(infer_ty) => infer_ty_to_string(cx, infer_ty), - ty_err => "[type error]".to_string(), + ty_err => "[type error]".to_owned(), ty_param(ref param_ty) => param_ty.user_string(cx), ty_enum(did, substs) | ty_struct(did, substs) => { let base = ty::item_path_str(cx, did); @@ -410,7 +410,7 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String { data.trait_ref.user_string(cx), data.item_name.user_string(cx)) } - ty_str => "str".to_string(), + ty_str => "str".to_owned(), ty_closure(ref did, substs) => { let closure_tys = cx.closure_tys.borrow(); closure_tys.get(did).map(|closure_type| { @@ -591,7 +591,7 @@ pub fn ty_to_short_str<'tcx>(cx: &ctxt<'tcx>, typ: Ty<'tcx>) -> String { impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for Option { fn repr(&self, tcx: &ctxt<'tcx>) -> String { match self { - &None => "None".to_string(), + &None => "None".to_owned(), &Some(ref t) => t.repr(tcx), } } @@ -614,7 +614,7 @@ impl<'tcx,T:Repr<'tcx>,U:Repr<'tcx>> Repr<'tcx> for Result { impl<'tcx> Repr<'tcx> for () { fn repr(&self, _tcx: &ctxt) -> String { - "()".to_string() + "()".to_owned() } } @@ -787,7 +787,7 @@ impl<'tcx> Repr<'tcx> for ty::ItemSubsts<'tcx> { impl<'tcx> Repr<'tcx> for subst::RegionSubsts { fn repr(&self, tcx: &ctxt) -> String { match *self { - subst::ErasedRegions => "erased".to_string(), + subst::ErasedRegions => "erased".to_owned(), subst::NonerasedRegions(ref regions) => regions.repr(tcx) } } @@ -798,10 +798,10 @@ impl<'tcx> Repr<'tcx> for ty::BuiltinBounds { let mut res = Vec::new(); for b in self { res.push(match b { - ty::BoundSend => "Send".to_string(), - ty::BoundSized => "Sized".to_string(), - ty::BoundCopy => "Copy".to_string(), - ty::BoundSync => "Sync".to_string(), + ty::BoundSend => "Send".to_owned(), + ty::BoundSized => "Sized".to_owned(), + ty::BoundCopy => "Copy".to_owned(), + ty::BoundSync => "Sync".to_owned(), }); } res.connect("+") @@ -911,7 +911,7 @@ impl<'tcx> Repr<'tcx> for ty::BoundRegion { format!("BrNamed({}, {})", id.repr(tcx), token::get_name(name)) } ty::BrFresh(id) => format!("BrFresh({})", id), - ty::BrEnv => "BrEnv".to_string() + ty::BrEnv => "BrEnv".to_owned() } } } @@ -940,7 +940,7 @@ impl<'tcx> Repr<'tcx> for ty::Region { } ty::ReStatic => { - "ReStatic".to_string() + "ReStatic".to_owned() } ty::ReInfer(ReVar(ref vid)) => { @@ -952,7 +952,7 @@ impl<'tcx> Repr<'tcx> for ty::Region { } ty::ReEmpty => { - "ReEmpty".to_string() + "ReEmpty".to_owned() } } } @@ -1166,7 +1166,7 @@ impl<'tcx> Repr<'tcx> for ty::FnOutput<'tcx> { ty::FnConverging(ty) => format!("FnConverging({0})", ty.repr(tcx)), ty::FnDiverging => - "FnDiverging".to_string() + "FnDiverging".to_owned() } } } @@ -1225,10 +1225,10 @@ impl<'tcx> Repr<'tcx> for ty::BuiltinBound { impl<'tcx> UserString<'tcx> for ty::BuiltinBound { fn user_string(&self, _tcx: &ctxt) -> String { match *self { - ty::BoundSend => "Send".to_string(), - ty::BoundSized => "Sized".to_string(), - ty::BoundCopy => "Copy".to_string(), - ty::BoundSync => "Sync".to_string(), + ty::BoundSend => "Send".to_owned(), + ty::BoundSized => "Sized".to_owned(), + ty::BoundCopy => "Copy".to_owned(), + ty::BoundSync => "Sync".to_owned(), } } } diff --git a/src/librustc_back/arm.rs b/src/librustc_back/arm.rs index 7325e4e7a2ece..a15b7d7c3d52e 100644 --- a/src/librustc_back/arm.rs +++ b/src/librustc_back/arm.rs @@ -13,12 +13,12 @@ use syntax::abi; pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { let cc_args = if target_triple.contains("thumb") { - vec!("-mthumb".to_string()) + vec!("-mthumb".to_owned()) } else { - vec!("-marm".to_string()) + vec!("-marm".to_owned()) }; return target_strs::t { - module_asm: "".to_string(), + module_asm: "".to_owned(), data_layout: match target_os { abi::OsMacos => { @@ -26,7 +26,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsiOS => { @@ -34,7 +34,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsWindows => { @@ -42,7 +42,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsLinux => { @@ -50,7 +50,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsAndroid => { @@ -58,7 +58,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => { @@ -66,7 +66,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } }, diff --git a/src/librustc_back/mips.rs b/src/librustc_back/mips.rs index b46150f75d084..2c72da32ba392 100644 --- a/src/librustc_back/mips.rs +++ b/src/librustc_back/mips.rs @@ -13,7 +13,7 @@ use syntax::abi; pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { return target_strs::t { - module_asm: "".to_string(), + module_asm: "".to_owned(), data_layout: match target_os { abi::OsMacos => { @@ -21,7 +21,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsiOS => { @@ -29,7 +29,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsWindows => { @@ -37,7 +37,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsLinux => { @@ -45,7 +45,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsAndroid => { @@ -53,7 +53,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => { @@ -61,7 +61,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } }, diff --git a/src/librustc_back/mipsel.rs b/src/librustc_back/mipsel.rs index c7fa7aa879ac2..8ebd3286d32ed 100644 --- a/src/librustc_back/mipsel.rs +++ b/src/librustc_back/mipsel.rs @@ -13,7 +13,7 @@ use syntax::abi; pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { return target_strs::t { - module_asm: "".to_string(), + module_asm: "".to_owned(), data_layout: match target_os { abi::OsMacos => { @@ -21,7 +21,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsiOS => { @@ -29,7 +29,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsWindows => { @@ -37,7 +37,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsLinux => { @@ -45,7 +45,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsAndroid => { @@ -53,7 +53,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => { @@ -61,7 +61,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string() + -a:0:64-n32".to_owned() } }, diff --git a/src/librustc_back/rpath.rs b/src/librustc_back/rpath.rs index 6674d3135a0bd..819e698bef5dc 100644 --- a/src/librustc_back/rpath.rs +++ b/src/librustc_back/rpath.rs @@ -178,8 +178,8 @@ mod tests { #[test] fn test_rpaths_to_flags() { let flags = rpaths_to_flags(&[ - "path1".to_string(), - "path2".to_string() + "path1".to_owned(), + "path2".to_owned() ]); assert_eq!(flags, ["-Wl,-rpath,path1", @@ -189,9 +189,9 @@ mod tests { #[test] fn test_minimize1() { let res = minimize_rpaths(&[ - "rpath1".to_string(), - "rpath2".to_string(), - "rpath1".to_string() + "rpath1".to_owned(), + "rpath2".to_owned(), + "rpath1".to_owned() ]); assert!(res == [ "rpath1", @@ -202,16 +202,16 @@ mod tests { #[test] fn test_minimize2() { let res = minimize_rpaths(&[ - "1a".to_string(), - "2".to_string(), - "2".to_string(), - "1a".to_string(), - "4a".to_string(), - "1a".to_string(), - "2".to_string(), - "3".to_string(), - "4a".to_string(), - "3".to_string() + "1a".to_owned(), + "2".to_owned(), + "2".to_owned(), + "1a".to_owned(), + "4a".to_owned(), + "1a".to_owned(), + "2".to_owned(), + "3".to_owned(), + "4a".to_owned(), + "3".to_owned() ]); assert!(res == [ "1a", diff --git a/src/librustc_back/sha2.rs b/src/librustc_back/sha2.rs index 9ed827da8b2e4..30cd9f7011d4e 100644 --- a/src/librustc_back/sha2.rs +++ b/src/librustc_back/sha2.rs @@ -584,21 +584,21 @@ mod tests { // Examples from wikipedia let wikipedia_tests = vec!( Test { - input: "".to_string(), + input: "".to_owned(), output_str: "e3b0c44298fc1c149afb\ - f4c8996fb92427ae41e4649b934ca495991b7852b855".to_string() + f4c8996fb92427ae41e4649b934ca495991b7852b855".to_owned() }, Test { input: "The quick brown fox jumps over the lazy \ - dog".to_string(), + dog".to_owned(), output_str: "d7a8fbb307d7809469ca\ - 9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592".to_string() + 9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592".to_owned() }, Test { input: "The quick brown fox jumps over the lazy \ - dog.".to_string(), + dog.".to_owned(), output_str: "ef537f25c895bfa78252\ - 6529a9b63d97aa631564d5d789c2b765448c8635fb6c".to_string() + 6529a9b63d97aa631564d5d789c2b765448c8635fb6c".to_owned() }); let tests = wikipedia_tests; diff --git a/src/librustc_back/target/aarch64_apple_ios.rs b/src/librustc_back/target/aarch64_apple_ios.rs index dd6bc672a03d9..0c4d4347b76a0 100644 --- a/src/librustc_back/target/aarch64_apple_ios.rs +++ b/src/librustc_back/target/aarch64_apple_ios.rs @@ -16,15 +16,15 @@ pub fn target() -> Target { // reference layout: e-m:o-i64:64-i128:128-n32:64-S128 data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ i128:128-f32:32:32-f64:64:64-v64:64:64-v128:128:128-\ - a:0:64-n32:64-S128".to_string(), - llvm_target: "arm64-apple-ios".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - arch: "aarch64".to_string(), - target_os: "ios".to_string(), - target_env: "".to_string(), + a:0:64-n32:64-S128".to_owned(), + llvm_target: "arm64-apple-ios".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + arch: "aarch64".to_owned(), + target_os: "ios".to_owned(), + target_env: "".to_owned(), options: TargetOptions { - features: "+neon,+fp-armv8,+cyclone".to_string(), + features: "+neon,+fp-armv8,+cyclone".to_owned(), eliminate_frame_pointer: false, .. opts(Arch::Arm64) }, diff --git a/src/librustc_back/target/aarch64_linux_android.rs b/src/librustc_back/target/aarch64_linux_android.rs index 67194e7ac5c7c..a0232527d83f2 100644 --- a/src/librustc_back/target/aarch64_linux_android.rs +++ b/src/librustc_back/target/aarch64_linux_android.rs @@ -14,13 +14,13 @@ pub fn target() -> Target { Target { data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - n32:64-S128".to_string(), - llvm_target: "aarch64-linux-android".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - arch: "aarch64".to_string(), - target_os: "android".to_string(), - target_env: "".to_string(), + n32:64-S128".to_owned(), + llvm_target: "aarch64-linux-android".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + arch: "aarch64".to_owned(), + target_os: "android".to_owned(), + target_env: "".to_owned(), options: super::android_base::opts(), } } diff --git a/src/librustc_back/target/aarch64_unknown_linux_gnu.rs b/src/librustc_back/target/aarch64_unknown_linux_gnu.rs index 18e67d066d036..7dafa8e4956ac 100644 --- a/src/librustc_back/target/aarch64_unknown_linux_gnu.rs +++ b/src/librustc_back/target/aarch64_unknown_linux_gnu.rs @@ -15,13 +15,13 @@ pub fn target() -> Target { Target { data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - n32:64-S128".to_string(), - llvm_target: "aarch64-unknown-linux-gnu".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - target_env: "gnu".to_string(), - arch: "aarch64".to_string(), - target_os: "linux".to_string(), + n32:64-S128".to_owned(), + llvm_target: "aarch64-unknown-linux-gnu".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + target_env: "gnu".to_owned(), + arch: "aarch64".to_owned(), + target_os: "linux".to_owned(), options: base, } } diff --git a/src/librustc_back/target/android_base.rs b/src/librustc_back/target/android_base.rs index 2883ffd6e9f22..e9f53aa4f4cb6 100644 --- a/src/librustc_back/target/android_base.rs +++ b/src/librustc_back/target/android_base.rs @@ -14,7 +14,7 @@ pub fn opts() -> TargetOptions { let mut base = super::linux_base::opts(); // Many of the symbols defined in compiler-rt are also defined in libgcc. // Android's linker doesn't like that by default. - base.pre_link_args.push("-Wl,--allow-multiple-definition".to_string()); + base.pre_link_args.push("-Wl,--allow-multiple-definition".to_owned()); base.is_like_android = true; base.position_independent_executables = true; base diff --git a/src/librustc_back/target/apple_base.rs b/src/librustc_back/target/apple_base.rs index 795a2c18bc6e6..e3110db0f58e2 100644 --- a/src/librustc_back/target/apple_base.rs +++ b/src/librustc_back/target/apple_base.rs @@ -15,14 +15,14 @@ pub fn opts() -> TargetOptions { TargetOptions { // OSX has -dead_strip, which doesn't rely on ffunction_sections function_sections: false, - linker: "cc".to_string(), + linker: "cc".to_owned(), dynamic_linking: true, executables: true, is_like_osx: true, morestack: true, has_rpath: true, - dll_prefix: "lib".to_string(), - dll_suffix: ".dylib".to_string(), + dll_prefix: "lib".to_owned(), + dll_suffix: ".dylib".to_owned(), pre_link_args: Vec::new(), .. Default::default() } diff --git a/src/librustc_back/target/apple_ios_base.rs b/src/librustc_back/target/apple_ios_base.rs index 7dcd6ba6cd11f..6932a805f1d0a 100644 --- a/src/librustc_back/target/apple_ios_base.rs +++ b/src/librustc_back/target/apple_ios_base.rs @@ -68,8 +68,8 @@ fn pre_link_args(arch: Arch) -> Vec { let arch_name = arch.to_string(); - vec!["-arch".to_string(), arch_name.to_string(), - "-Wl,-syslibroot".to_string(), get_sdk_root(sdk_name)] + vec!["-arch".to_owned(), arch_name.to_string(), + "-Wl,-syslibroot".to_owned(), get_sdk_root(sdk_name)] } fn target_cpu(arch: Arch) -> String { diff --git a/src/librustc_back/target/arm_linux_androideabi.rs b/src/librustc_back/target/arm_linux_androideabi.rs index cbaa2b205b055..78529747b3cd9 100644 --- a/src/librustc_back/target/arm_linux_androideabi.rs +++ b/src/librustc_back/target/arm_linux_androideabi.rs @@ -12,18 +12,18 @@ use target::Target; pub fn target() -> Target { let mut base = super::android_base::opts(); - base.features = "+v7".to_string(); + base.features = "+v7".to_owned(); Target { data_layout: "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:64:128-a:0:64-\ - n32".to_string(), - llvm_target: "arm-linux-androideabi".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "32".to_string(), - arch: "arm".to_string(), - target_os: "android".to_string(), - target_env: "gnu".to_string(), + n32".to_owned(), + llvm_target: "arm-linux-androideabi".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "arm".to_owned(), + target_os: "android".to_owned(), + target_env: "gnu".to_owned(), options: base, } } diff --git a/src/librustc_back/target/arm_unknown_linux_gnueabi.rs b/src/librustc_back/target/arm_unknown_linux_gnueabi.rs index 30015c4a7e6ff..3dff6b15dfb35 100644 --- a/src/librustc_back/target/arm_unknown_linux_gnueabi.rs +++ b/src/librustc_back/target/arm_unknown_linux_gnueabi.rs @@ -17,16 +17,16 @@ pub fn target() -> Target { -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string(), - llvm_target: "arm-unknown-linux-gnueabi".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "32".to_string(), - arch: "arm".to_string(), - target_os: "linux".to_string(), - target_env: "gnueabi".to_string(), + -a:0:64-n32".to_owned(), + llvm_target: "arm-unknown-linux-gnueabi".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "arm".to_owned(), + target_os: "linux".to_owned(), + target_env: "gnueabi".to_owned(), options: TargetOptions { - features: "+v6".to_string(), + features: "+v6".to_owned(), .. base }, } diff --git a/src/librustc_back/target/arm_unknown_linux_gnueabihf.rs b/src/librustc_back/target/arm_unknown_linux_gnueabihf.rs index 8f8c7114e6eff..b5f8c6824ec34 100644 --- a/src/librustc_back/target/arm_unknown_linux_gnueabihf.rs +++ b/src/librustc_back/target/arm_unknown_linux_gnueabihf.rs @@ -17,16 +17,16 @@ pub fn target() -> Target { -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string(), - llvm_target: "arm-unknown-linux-gnueabihf".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "32".to_string(), - arch: "arm".to_string(), - target_os: "linux".to_string(), - target_env: "gnueabihf".to_string(), + -a:0:64-n32".to_owned(), + llvm_target: "arm-unknown-linux-gnueabihf".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "arm".to_owned(), + target_os: "linux".to_owned(), + target_env: "gnueabihf".to_owned(), options: TargetOptions { - features: "+v6,+vfp2".to_string(), + features: "+v6,+vfp2".to_owned(), .. base } } diff --git a/src/librustc_back/target/armv7_apple_ios.rs b/src/librustc_back/target/armv7_apple_ios.rs index 3b55993659de2..a2b9b1a8faff0 100644 --- a/src/librustc_back/target/armv7_apple_ios.rs +++ b/src/librustc_back/target/armv7_apple_ios.rs @@ -13,15 +13,15 @@ use super::apple_ios_base::{opts, Arch}; pub fn target() -> Target { Target { - data_layout: "e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(), - llvm_target: "armv7-apple-ios".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "32".to_string(), - arch: "arm".to_string(), - target_os: "ios".to_string(), - target_env: "".to_string(), + data_layout: "e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_owned(), + llvm_target: "armv7-apple-ios".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "arm".to_owned(), + target_os: "ios".to_owned(), + target_env: "".to_owned(), options: TargetOptions { - features: "+v7,+vfp3,+neon".to_string(), + features: "+v7,+vfp3,+neon".to_owned(), .. opts(Arch::Armv7) } } diff --git a/src/librustc_back/target/armv7s_apple_ios.rs b/src/librustc_back/target/armv7s_apple_ios.rs index 5a67e3fe127d6..b0b824f27722a 100644 --- a/src/librustc_back/target/armv7s_apple_ios.rs +++ b/src/librustc_back/target/armv7s_apple_ios.rs @@ -13,15 +13,15 @@ use super::apple_ios_base::{opts, Arch}; pub fn target() -> Target { Target { - data_layout: "e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(), - llvm_target: "armv7s-apple-ios".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "32".to_string(), - arch: "arm".to_string(), - target_os: "ios".to_string(), - target_env: "".to_string(), + data_layout: "e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_owned(), + llvm_target: "armv7s-apple-ios".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "arm".to_owned(), + target_os: "ios".to_owned(), + target_env: "".to_owned(), options: TargetOptions { - features: "+v7,+vfp4,+neon".to_string(), + features: "+v7,+vfp4,+neon".to_owned(), .. opts(Arch::Armv7s) } } diff --git a/src/librustc_back/target/bitrig_base.rs b/src/librustc_back/target/bitrig_base.rs index 6e5a48c0ea16c..ea90f2603f337 100644 --- a/src/librustc_back/target/bitrig_base.rs +++ b/src/librustc_back/target/bitrig_base.rs @@ -13,7 +13,7 @@ use std::default::Default; pub fn opts() -> TargetOptions { TargetOptions { - linker: "cc".to_string(), + linker: "cc".to_owned(), dynamic_linking: true, executables: true, morestack: false, diff --git a/src/librustc_back/target/dragonfly_base.rs b/src/librustc_back/target/dragonfly_base.rs index a56621ff97ea5..56b12063ae480 100644 --- a/src/librustc_back/target/dragonfly_base.rs +++ b/src/librustc_back/target/dragonfly_base.rs @@ -13,20 +13,20 @@ use std::default::Default; pub fn opts() -> TargetOptions { TargetOptions { - linker: "cc".to_string(), + linker: "cc".to_owned(), dynamic_linking: true, executables: true, morestack: true, linker_is_gnu: true, has_rpath: true, pre_link_args: vec!( - "-L/usr/local/lib".to_string(), - "-L/usr/lib/gcc47".to_string(), + "-L/usr/local/lib".to_owned(), + "-L/usr/lib/gcc47".to_owned(), // GNU-style linkers will use this to omit linking to libraries // which don't actually fulfill any relocations, but only for // libraries which follow this flag. Thus, use it before // specifying libraries to link to. - "-Wl,--as-needed".to_string(), + "-Wl,--as-needed".to_owned(), ), position_independent_executables: true, .. Default::default() diff --git a/src/librustc_back/target/freebsd_base.rs b/src/librustc_back/target/freebsd_base.rs index 3ec6307c72f86..5acfe1a25be60 100644 --- a/src/librustc_back/target/freebsd_base.rs +++ b/src/librustc_back/target/freebsd_base.rs @@ -13,7 +13,7 @@ use std::default::Default; pub fn opts() -> TargetOptions { TargetOptions { - linker: "cc".to_string(), + linker: "cc".to_owned(), dynamic_linking: true, executables: true, morestack: true, diff --git a/src/librustc_back/target/i386_apple_ios.rs b/src/librustc_back/target/i386_apple_ios.rs index a9a073e2a8c64..6f8b669f1a571 100644 --- a/src/librustc_back/target/i386_apple_ios.rs +++ b/src/librustc_back/target/i386_apple_ios.rs @@ -17,13 +17,13 @@ pub fn target() -> Target { -i32:32:32-i64:32:64\ -f32:32:32-f64:32:64-v64:64:64\ -v128:128:128-a:0:64-f80:128:128\ - -n8:16:32".to_string(), - llvm_target: "i386-apple-ios".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "32".to_string(), - arch: "x86".to_string(), - target_os: "ios".to_string(), - target_env: "".to_string(), + -n8:16:32".to_owned(), + llvm_target: "i386-apple-ios".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "x86".to_owned(), + target_os: "ios".to_owned(), + target_env: "".to_owned(), options: opts(Arch::I386) } } diff --git a/src/librustc_back/target/i686_apple_darwin.rs b/src/librustc_back/target/i686_apple_darwin.rs index 47b329982d43e..4316849e3ce6f 100644 --- a/src/librustc_back/target/i686_apple_darwin.rs +++ b/src/librustc_back/target/i686_apple_darwin.rs @@ -12,21 +12,21 @@ use target::Target; pub fn target() -> Target { let mut base = super::apple_base::opts(); - base.cpu = "yonah".to_string(); - base.pre_link_args.push("-m32".to_string()); + base.cpu = "yonah".to_owned(); + base.pre_link_args.push("-m32".to_owned()); Target { data_layout: "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16\ -i32:32:32-i64:32:64\ -f32:32:32-f64:32:64-v64:64:64\ -v128:128:128-a:0:64-f80:128:128\ - -n8:16:32".to_string(), - llvm_target: "i686-apple-darwin".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "32".to_string(), - arch: "x86".to_string(), - target_os: "macos".to_string(), - target_env: "".to_string(), + -n8:16:32".to_owned(), + llvm_target: "i686-apple-darwin".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "x86".to_owned(), + target_os: "macos".to_owned(), + target_env: "".to_owned(), options: base, } } diff --git a/src/librustc_back/target/i686_pc_windows_gnu.rs b/src/librustc_back/target/i686_pc_windows_gnu.rs index 9e2aa20085c36..cead99f5a060c 100644 --- a/src/librustc_back/target/i686_pc_windows_gnu.rs +++ b/src/librustc_back/target/i686_pc_windows_gnu.rs @@ -12,25 +12,25 @@ use target::Target; pub fn target() -> Target { let mut options = super::windows_base::opts(); - options.cpu = "pentium4".to_string(); + options.cpu = "pentium4".to_owned(); // Mark all dynamic libraries and executables as compatible with the larger 4GiB address // space available to x86 Windows binaries on x86_64. - options.pre_link_args.push("-Wl,--large-address-aware".to_string()); + options.pre_link_args.push("-Wl,--large-address-aware".to_owned()); // Make sure that we link to the dynamic libgcc, otherwise cross-module // DWARF stack unwinding will not work. // This behavior may be overridden by -Clink-args="-static-libgcc" - options.pre_link_args.push("-shared-libgcc".to_string()); + options.pre_link_args.push("-shared-libgcc".to_owned()); Target { - data_layout: "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32".to_string(), - llvm_target: "i686-pc-windows-gnu".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "32".to_string(), - arch: "x86".to_string(), - target_os: "windows".to_string(), - target_env: "gnu".to_string(), + data_layout: "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32".to_owned(), + llvm_target: "i686-pc-windows-gnu".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "x86".to_owned(), + target_os: "windows".to_owned(), + target_env: "gnu".to_owned(), options: options, } } diff --git a/src/librustc_back/target/i686_unknown_dragonfly.rs b/src/librustc_back/target/i686_unknown_dragonfly.rs index ecabe71ad4c6c..7f911a2ee9f9c 100644 --- a/src/librustc_back/target/i686_unknown_dragonfly.rs +++ b/src/librustc_back/target/i686_unknown_dragonfly.rs @@ -12,17 +12,17 @@ use target::Target; pub fn target() -> Target { let mut base = super::dragonfly_base::opts(); - base.cpu = "pentium4".to_string(); - base.pre_link_args.push("-m32".to_string()); + base.cpu = "pentium4".to_owned(); + base.pre_link_args.push("-m32".to_owned()); Target { - data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(), - llvm_target: "i686-unknown-dragonfly".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "32".to_string(), - arch: "x86".to_string(), - target_os: "dragonfly".to_string(), - target_env: "".to_string(), + data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_owned(), + llvm_target: "i686-unknown-dragonfly".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "x86".to_owned(), + target_os: "dragonfly".to_owned(), + target_env: "".to_owned(), options: base, } } diff --git a/src/librustc_back/target/i686_unknown_linux_gnu.rs b/src/librustc_back/target/i686_unknown_linux_gnu.rs index 21094ad905e90..303bfa42862d4 100644 --- a/src/librustc_back/target/i686_unknown_linux_gnu.rs +++ b/src/librustc_back/target/i686_unknown_linux_gnu.rs @@ -12,17 +12,17 @@ use target::Target; pub fn target() -> Target { let mut base = super::linux_base::opts(); - base.cpu = "pentium4".to_string(); - base.pre_link_args.push("-m32".to_string()); + base.cpu = "pentium4".to_owned(); + base.pre_link_args.push("-m32".to_owned()); Target { - data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(), - llvm_target: "i686-unknown-linux-gnu".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "32".to_string(), - arch: "x86".to_string(), - target_os: "linux".to_string(), - target_env: "gnu".to_string(), + data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_owned(), + llvm_target: "i686-unknown-linux-gnu".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "x86".to_owned(), + target_os: "linux".to_owned(), + target_env: "gnu".to_owned(), options: base, } } diff --git a/src/librustc_back/target/linux_base.rs b/src/librustc_back/target/linux_base.rs index 3ae70ca854bdb..69225609d5775 100644 --- a/src/librustc_back/target/linux_base.rs +++ b/src/librustc_back/target/linux_base.rs @@ -26,7 +26,7 @@ pub fn opts() -> TargetOptions { // resolutions the linker does). This option only applies to all // following libraries so we're sure to pass it as one of the first // arguments. - "-Wl,--as-needed".to_string(), + "-Wl,--as-needed".to_owned(), ], position_independent_executables: true, .. Default::default() diff --git a/src/librustc_back/target/mips_unknown_linux_gnu.rs b/src/librustc_back/target/mips_unknown_linux_gnu.rs index 4662ff1958ba8..3824f34a28d6a 100644 --- a/src/librustc_back/target/mips_unknown_linux_gnu.rs +++ b/src/librustc_back/target/mips_unknown_linux_gnu.rs @@ -16,13 +16,13 @@ pub fn target() -> Target { -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string(), - llvm_target: "mips-unknown-linux-gnu".to_string(), - target_endian: "big".to_string(), - target_pointer_width: "32".to_string(), - arch: "mips".to_string(), - target_os: "linux".to_string(), - target_env: "gnu".to_string(), + -a:0:64-n32".to_owned(), + llvm_target: "mips-unknown-linux-gnu".to_owned(), + target_endian: "big".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "mips".to_owned(), + target_os: "linux".to_owned(), + target_env: "gnu".to_owned(), options: super::linux_base::opts() } } diff --git a/src/librustc_back/target/mipsel_unknown_linux_gnu.rs b/src/librustc_back/target/mipsel_unknown_linux_gnu.rs index 80e38c5ddea98..4383342159152 100644 --- a/src/librustc_back/target/mipsel_unknown_linux_gnu.rs +++ b/src/librustc_back/target/mipsel_unknown_linux_gnu.rs @@ -16,13 +16,13 @@ pub fn target() -> Target { -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a:0:64-n32".to_string(), - llvm_target: "mipsel-unknown-linux-gnu".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "32".to_string(), - arch: "mips".to_string(), - target_os: "linux".to_string(), - target_env: "gnu".to_string(), + -a:0:64-n32".to_owned(), + llvm_target: "mipsel-unknown-linux-gnu".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "mips".to_owned(), + target_os: "linux".to_owned(), + target_env: "gnu".to_owned(), options: super::linux_base::opts() } diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 402fbcd8d8d8e..85d7ed20cb566 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -172,25 +172,25 @@ impl Default for TargetOptions { /// incomplete, and if used for compilation, will certainly not work. fn default() -> TargetOptions { TargetOptions { - linker: "cc".to_string(), - ar: "ar".to_string(), + linker: "cc".to_owned(), + ar: "ar".to_owned(), pre_link_args: Vec::new(), post_link_args: Vec::new(), - cpu: "generic".to_string(), - features: "".to_string(), + cpu: "generic".to_owned(), + features: "".to_owned(), dynamic_linking: false, executables: false, morestack: false, - relocation_model: "pic".to_string(), - code_model: "default".to_string(), + relocation_model: "pic".to_owned(), + code_model: "default".to_owned(), disable_redzone: false, eliminate_frame_pointer: true, function_sections: true, - dll_prefix: "lib".to_string(), - dll_suffix: ".so".to_string(), - exe_suffix: "".to_string(), - staticlib_prefix: "lib".to_string(), - staticlib_suffix: ".a".to_string(), + dll_prefix: "lib".to_owned(), + dll_suffix: ".so".to_owned(), + exe_suffix: "".to_owned(), + staticlib_prefix: "lib".to_owned(), + staticlib_suffix: ".a".to_owned(), is_like_osx: false, is_like_windows: false, is_like_android: false, diff --git a/src/librustc_back/target/openbsd_base.rs b/src/librustc_back/target/openbsd_base.rs index 0f2ab32be2431..a3d6d612b7ba2 100644 --- a/src/librustc_back/target/openbsd_base.rs +++ b/src/librustc_back/target/openbsd_base.rs @@ -13,7 +13,7 @@ use std::default::Default; pub fn opts() -> TargetOptions { TargetOptions { - linker: "cc".to_string(), + linker: "cc".to_owned(), dynamic_linking: true, executables: true, morestack: false, @@ -24,7 +24,7 @@ pub fn opts() -> TargetOptions { // which don't actually fulfill any relocations, but only for // libraries which follow this flag. Thus, use it before // specifying libraries to link to. - "-Wl,--as-needed".to_string(), + "-Wl,--as-needed".to_owned(), ), position_independent_executables: true, .. Default::default() diff --git a/src/librustc_back/target/powerpc_unknown_linux_gnu.rs b/src/librustc_back/target/powerpc_unknown_linux_gnu.rs index 3a2b4bd16065e..9512884f39515 100644 --- a/src/librustc_back/target/powerpc_unknown_linux_gnu.rs +++ b/src/librustc_back/target/powerpc_unknown_linux_gnu.rs @@ -12,16 +12,16 @@ use target::Target; pub fn target() -> Target { let mut base = super::linux_base::opts(); - base.pre_link_args.push("-m32".to_string()); + base.pre_link_args.push("-m32".to_owned()); Target { - data_layout: "E-S8-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(), - llvm_target: "powerpc-unknown-linux-gnu".to_string(), - target_endian: "big".to_string(), - target_pointer_width: "32".to_string(), - arch: "powerpc".to_string(), - target_os: "linux".to_string(), - target_env: "gnu".to_string(), + data_layout: "E-S8-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_owned(), + llvm_target: "powerpc-unknown-linux-gnu".to_owned(), + target_endian: "big".to_owned(), + target_pointer_width: "32".to_owned(), + arch: "powerpc".to_owned(), + target_os: "linux".to_owned(), + target_env: "gnu".to_owned(), options: base, } } diff --git a/src/librustc_back/target/windows_base.rs b/src/librustc_back/target/windows_base.rs index 148be8cab76e3..4c471c4af3167 100644 --- a/src/librustc_back/target/windows_base.rs +++ b/src/librustc_back/target/windows_base.rs @@ -15,14 +15,14 @@ pub fn opts() -> TargetOptions { TargetOptions { // FIXME(#13846) this should be enabled for windows function_sections: false, - linker: "gcc".to_string(), + linker: "gcc".to_owned(), dynamic_linking: true, executables: true, - dll_prefix: "".to_string(), - dll_suffix: ".dll".to_string(), - exe_suffix: ".exe".to_string(), - staticlib_prefix: "".to_string(), - staticlib_suffix: ".lib".to_string(), + dll_prefix: "".to_owned(), + dll_suffix: ".dll".to_owned(), + exe_suffix: ".exe".to_owned(), + staticlib_prefix: "".to_owned(), + staticlib_suffix: ".lib".to_owned(), morestack: false, is_like_windows: true, pre_link_args: vec!( @@ -51,14 +51,14 @@ pub fn opts() -> TargetOptions { // // [1] - https://sourceware.org/bugzilla/show_bug.cgi?id=13130 // [2] - https://code.google.com/p/go/issues/detail?id=2139 - "-Wl,--enable-long-section-names".to_string(), + "-Wl,--enable-long-section-names".to_owned(), // Tell GCC to avoid linker plugins, because we are not bundling // them with Windows installer, and Rust does its own LTO anyways. - "-fno-use-linker-plugin".to_string(), + "-fno-use-linker-plugin".to_owned(), // Always enable DEP (NX bit) when it is available - "-Wl,--nxcompat".to_string(), + "-Wl,--nxcompat".to_owned(), ), .. Default::default() diff --git a/src/librustc_back/target/windows_msvc_base.rs b/src/librustc_back/target/windows_msvc_base.rs index 30d74c807352c..88b629006300b 100644 --- a/src/librustc_back/target/windows_msvc_base.rs +++ b/src/librustc_back/target/windows_msvc_base.rs @@ -14,7 +14,7 @@ use std::default::Default; pub fn opts() -> TargetOptions { TargetOptions { function_sections: true, - linker: "link.exe".to_string(), + linker: "link.exe".to_owned(), // When taking a look at the value of this `ar` field, one might expect // `lib.exe` to be the value here! The `lib.exe` program is the default // tool for managing `.lib` archives on Windows, but unfortunately the @@ -45,20 +45,20 @@ pub fn opts() -> TargetOptions { // // Perhaps one day we won't even need this tool at all and we'll just be // able to make library calls into LLVM! - ar: "llvm-ar.exe".to_string(), + ar: "llvm-ar.exe".to_owned(), dynamic_linking: true, executables: true, - dll_prefix: "".to_string(), - dll_suffix: ".dll".to_string(), - exe_suffix: ".exe".to_string(), - staticlib_prefix: "".to_string(), - staticlib_suffix: ".lib".to_string(), + dll_prefix: "".to_owned(), + dll_suffix: ".dll".to_owned(), + exe_suffix: ".exe".to_owned(), + staticlib_prefix: "".to_owned(), + staticlib_suffix: ".lib".to_owned(), morestack: false, is_like_windows: true, is_like_msvc: true, pre_link_args: vec![ - "/NOLOGO".to_string(), - "/NXCOMPAT".to_string(), + "/NOLOGO".to_owned(), + "/NXCOMPAT".to_owned(), ], .. Default::default() diff --git a/src/librustc_back/target/x86_64_apple_darwin.rs b/src/librustc_back/target/x86_64_apple_darwin.rs index 89a67da2d8bbc..7bd6abe873afa 100644 --- a/src/librustc_back/target/x86_64_apple_darwin.rs +++ b/src/librustc_back/target/x86_64_apple_darwin.rs @@ -12,20 +12,20 @@ use target::Target; pub fn target() -> Target { let mut base = super::apple_base::opts(); - base.cpu = "core2".to_string(); + base.cpu = "core2".to_owned(); base.eliminate_frame_pointer = false; - base.pre_link_args.push("-m64".to_string()); + base.pre_link_args.push("-m64".to_owned()); Target { data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64".to_string(), - llvm_target: "x86_64-apple-darwin".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - arch: "x86_64".to_string(), - target_os: "macos".to_string(), - target_env: "".to_string(), + s0:64:64-f80:128:128-n8:16:32:64".to_owned(), + llvm_target: "x86_64-apple-darwin".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + arch: "x86_64".to_owned(), + target_os: "macos".to_owned(), + target_env: "".to_owned(), options: base, } } diff --git a/src/librustc_back/target/x86_64_apple_ios.rs b/src/librustc_back/target/x86_64_apple_ios.rs index 74491629ed859..3d8a3a6eb6d4a 100644 --- a/src/librustc_back/target/x86_64_apple_ios.rs +++ b/src/librustc_back/target/x86_64_apple_ios.rs @@ -15,13 +15,13 @@ pub fn target() -> Target { Target { data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64".to_string(), - llvm_target: "x86_64-apple-ios".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - arch: "x86_64".to_string(), - target_os: "ios".to_string(), - target_env: "".to_string(), + s0:64:64-f80:128:128-n8:16:32:64".to_owned(), + llvm_target: "x86_64-apple-ios".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + arch: "x86_64".to_owned(), + target_os: "ios".to_owned(), + target_env: "".to_owned(), options: opts(Arch::X86_64) } } diff --git a/src/librustc_back/target/x86_64_pc_windows_gnu.rs b/src/librustc_back/target/x86_64_pc_windows_gnu.rs index bea7d16e9dfad..499fd6bfd33ec 100644 --- a/src/librustc_back/target/x86_64_pc_windows_gnu.rs +++ b/src/librustc_back/target/x86_64_pc_windows_gnu.rs @@ -12,22 +12,22 @@ use target::Target; pub fn target() -> Target { let mut base = super::windows_base::opts(); - base.cpu = "x86-64".to_string(); + base.cpu = "x86-64".to_owned(); // On Win64 unwinding is handled by the OS, so we can link libgcc statically. - base.pre_link_args.push("-static-libgcc".to_string()); - base.pre_link_args.push("-m64".to_string()); + base.pre_link_args.push("-static-libgcc".to_owned()); + base.pre_link_args.push("-m64".to_owned()); Target { // FIXME: Test this. Copied from linux (#2398) data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(), - llvm_target: "x86_64-pc-windows-gnu".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - arch: "x86_64".to_string(), - target_os: "windows".to_string(), - target_env: "gnu".to_string(), + s0:64:64-f80:128:128-n8:16:32:64-S128".to_owned(), + llvm_target: "x86_64-pc-windows-gnu".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + arch: "x86_64".to_owned(), + target_os: "windows".to_owned(), + target_env: "gnu".to_owned(), options: base, } } diff --git a/src/librustc_back/target/x86_64_pc_windows_msvc.rs b/src/librustc_back/target/x86_64_pc_windows_msvc.rs index f7c3ca4b3f6ed..a05be46eaded7 100644 --- a/src/librustc_back/target/x86_64_pc_windows_msvc.rs +++ b/src/librustc_back/target/x86_64_pc_windows_msvc.rs @@ -12,7 +12,7 @@ use target::Target; pub fn target() -> Target { let mut base = super::windows_msvc_base::opts(); - base.cpu = "x86-64".to_string(); + base.cpu = "x86-64".to_owned(); Target { // This is currently in sync with the specification for @@ -21,13 +21,13 @@ pub fn target() -> Target { // at least for now. data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(), - llvm_target: "x86_64-pc-windows-msvc".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - arch: "x86_64".to_string(), - target_os: "windows".to_string(), - target_env: "msvc".to_string(), + s0:64:64-f80:128:128-n8:16:32:64-S128".to_owned(), + llvm_target: "x86_64-pc-windows-msvc".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + arch: "x86_64".to_owned(), + target_os: "windows".to_owned(), + target_env: "msvc".to_owned(), options: base, } } diff --git a/src/librustc_back/target/x86_64_unknown_bitrig.rs b/src/librustc_back/target/x86_64_unknown_bitrig.rs index 201c56b2e15c6..b2b3711442322 100644 --- a/src/librustc_back/target/x86_64_unknown_bitrig.rs +++ b/src/librustc_back/target/x86_64_unknown_bitrig.rs @@ -12,18 +12,18 @@ use target::Target; pub fn target() -> Target { let mut base = super::bitrig_base::opts(); - base.pre_link_args.push("-m64".to_string()); + base.pre_link_args.push("-m64".to_owned()); Target { data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(), - llvm_target: "x86_64-unknown-bitrig".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - arch: "x86_64".to_string(), - target_os: "bitrig".to_string(), - target_env: "".to_string(), + s0:64:64-f80:128:128-n8:16:32:64-S128".to_owned(), + llvm_target: "x86_64-unknown-bitrig".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + arch: "x86_64".to_owned(), + target_os: "bitrig".to_owned(), + target_env: "".to_owned(), options: base, } } diff --git a/src/librustc_back/target/x86_64_unknown_dragonfly.rs b/src/librustc_back/target/x86_64_unknown_dragonfly.rs index c590f0297b948..8bf07d78fbd84 100644 --- a/src/librustc_back/target/x86_64_unknown_dragonfly.rs +++ b/src/librustc_back/target/x86_64_unknown_dragonfly.rs @@ -12,19 +12,19 @@ use target::Target; pub fn target() -> Target { let mut base = super::dragonfly_base::opts(); - base.cpu = "x86-64".to_string(); - base.pre_link_args.push("-m64".to_string()); + base.cpu = "x86-64".to_owned(); + base.pre_link_args.push("-m64".to_owned()); Target { data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(), - llvm_target: "x86_64-unknown-dragonfly".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - arch: "x86_64".to_string(), - target_os: "dragonfly".to_string(), - target_env: "".to_string(), + s0:64:64-f80:128:128-n8:16:32:64-S128".to_owned(), + llvm_target: "x86_64-unknown-dragonfly".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + arch: "x86_64".to_owned(), + target_os: "dragonfly".to_owned(), + target_env: "".to_owned(), options: base, } } diff --git a/src/librustc_back/target/x86_64_unknown_freebsd.rs b/src/librustc_back/target/x86_64_unknown_freebsd.rs index 0d8ea90a2ab04..eef77c701868f 100644 --- a/src/librustc_back/target/x86_64_unknown_freebsd.rs +++ b/src/librustc_back/target/x86_64_unknown_freebsd.rs @@ -12,19 +12,19 @@ use target::Target; pub fn target() -> Target { let mut base = super::freebsd_base::opts(); - base.cpu = "x86-64".to_string(); - base.pre_link_args.push("-m64".to_string()); + base.cpu = "x86-64".to_owned(); + base.pre_link_args.push("-m64".to_owned()); Target { data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(), - llvm_target: "x86_64-unknown-freebsd".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - arch: "x86_64".to_string(), - target_os: "freebsd".to_string(), - target_env: "".to_string(), + s0:64:64-f80:128:128-n8:16:32:64-S128".to_owned(), + llvm_target: "x86_64-unknown-freebsd".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + arch: "x86_64".to_owned(), + target_os: "freebsd".to_owned(), + target_env: "".to_owned(), options: base, } } diff --git a/src/librustc_back/target/x86_64_unknown_linux_gnu.rs b/src/librustc_back/target/x86_64_unknown_linux_gnu.rs index ba945afc5649b..57c2d4665eeb6 100644 --- a/src/librustc_back/target/x86_64_unknown_linux_gnu.rs +++ b/src/librustc_back/target/x86_64_unknown_linux_gnu.rs @@ -12,19 +12,19 @@ use target::Target; pub fn target() -> Target { let mut base = super::linux_base::opts(); - base.cpu = "x86-64".to_string(); - base.pre_link_args.push("-m64".to_string()); + base.cpu = "x86-64".to_owned(); + base.pre_link_args.push("-m64".to_owned()); Target { data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(), - llvm_target: "x86_64-unknown-linux-gnu".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - arch: "x86_64".to_string(), - target_os: "linux".to_string(), - target_env: "gnu".to_string(), + s0:64:64-f80:128:128-n8:16:32:64-S128".to_owned(), + llvm_target: "x86_64-unknown-linux-gnu".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + arch: "x86_64".to_owned(), + target_os: "linux".to_owned(), + target_env: "gnu".to_owned(), options: base, } } diff --git a/src/librustc_back/target/x86_64_unknown_linux_musl.rs b/src/librustc_back/target/x86_64_unknown_linux_musl.rs index 3debad2e8f201..8ebf2592f58d5 100644 --- a/src/librustc_back/target/x86_64_unknown_linux_musl.rs +++ b/src/librustc_back/target/x86_64_unknown_linux_musl.rs @@ -12,19 +12,19 @@ use target::Target; pub fn target() -> Target { let mut base = super::linux_base::opts(); - base.cpu = "x86-64".to_string(); - base.pre_link_args.push("-m64".to_string()); + base.cpu = "x86-64".to_owned(); + base.pre_link_args.push("-m64".to_owned()); // Make sure that the linker/gcc really don't pull in anything, including // default objects, libs, etc. - base.pre_link_args.push("-nostdlib".to_string()); - base.pre_link_args.push("-static".to_string()); + base.pre_link_args.push("-nostdlib".to_owned()); + base.pre_link_args.push("-static".to_owned()); // At least when this was tested, the linker would not add the // `GNU_EH_FRAME` program header to executables generated, which is required // when unwinding to locate the unwinding information. I'm not sure why this // argument is *not* necessary for normal builds, but it can't hurt! - base.pre_link_args.push("-Wl,--eh-frame-hdr".to_string()); + base.pre_link_args.push("-Wl,--eh-frame-hdr".to_owned()); // There's a whole bunch of circular dependencies when dealing with MUSL // unfortunately. To put this in perspective libc is statically linked to @@ -48,8 +48,8 @@ pub fn target() -> Target { // link everything as a group, not stripping anything out until everything // is processed. The linker will still perform a pass to strip out object // files but it won't do so until all objects/archives have been processed. - base.pre_link_args.push("-Wl,-(".to_string()); - base.post_link_args.push("-Wl,-)".to_string()); + base.pre_link_args.push("-Wl,-(".to_owned()); + base.post_link_args.push("-Wl,-)".to_owned()); // When generating a statically linked executable there's generally some // small setup needed which is listed in these files. These are provided by @@ -58,9 +58,9 @@ pub fn target() -> Target { // // Each target directory for musl has these object files included in it so // they'll be included from there. - base.pre_link_objects.push("crt1.o".to_string()); - base.pre_link_objects.push("crti.o".to_string()); - base.post_link_objects.push("crtn.o".to_string()); + base.pre_link_objects.push("crt1.o".to_owned()); + base.pre_link_objects.push("crti.o".to_owned()); + base.post_link_objects.push("crtn.o".to_owned()); // MUSL support doesn't currently include dynamic linking, so there's no // need for dylibs or rpath business. Additionally `-pie` is incompatible @@ -72,13 +72,13 @@ pub fn target() -> Target { Target { data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(), - llvm_target: "x86_64-unknown-linux-musl".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - arch: "x86_64".to_string(), - target_os: "linux".to_string(), - target_env: "musl".to_string(), + s0:64:64-f80:128:128-n8:16:32:64-S128".to_owned(), + llvm_target: "x86_64-unknown-linux-musl".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + arch: "x86_64".to_owned(), + target_os: "linux".to_owned(), + target_env: "musl".to_owned(), options: base, } } diff --git a/src/librustc_back/target/x86_64_unknown_openbsd.rs b/src/librustc_back/target/x86_64_unknown_openbsd.rs index 7f64259adf9f8..de36963462a60 100644 --- a/src/librustc_back/target/x86_64_unknown_openbsd.rs +++ b/src/librustc_back/target/x86_64_unknown_openbsd.rs @@ -12,18 +12,18 @@ use target::Target; pub fn target() -> Target { let mut base = super::openbsd_base::opts(); - base.pre_link_args.push("-m64".to_string()); + base.pre_link_args.push("-m64".to_owned()); Target { data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(), - llvm_target: "x86_64-unknown-openbsd".to_string(), - target_endian: "little".to_string(), - target_pointer_width: "64".to_string(), - arch: "x86_64".to_string(), - target_os: "openbsd".to_string(), - target_env: "".to_string(), + s0:64:64-f80:128:128-n8:16:32:64-S128".to_owned(), + llvm_target: "x86_64-unknown-openbsd".to_owned(), + target_endian: "little".to_owned(), + target_pointer_width: "64".to_owned(), + arch: "x86_64".to_owned(), + target_os: "openbsd".to_owned(), + target_env: "".to_owned(), options: base, } } diff --git a/src/librustc_back/x86.rs b/src/librustc_back/x86.rs index 1c6eacc355947..751660dfda7dd 100644 --- a/src/librustc_back/x86.rs +++ b/src/librustc_back/x86.rs @@ -15,7 +15,7 @@ use syntax::abi; pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { return target_strs::t { - module_asm: "".to_string(), + module_asm: "".to_owned(), data_layout: match target_os { abi::OsMacos => { @@ -23,7 +23,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -i32:32:32-i64:32:64\ -f32:32:32-f64:32:64-v64:64:64\ -v128:128:128-a:0:64-f80:128:128\ - -n8:16:32".to_string() + -n8:16:32".to_owned() } abi::OsiOS => { @@ -31,28 +31,28 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -i32:32:32-i64:32:64\ -f32:32:32-f64:32:64-v64:64:64\ -v128:128:128-a:0:64-f80:128:128\ - -n8:16:32".to_string() + -n8:16:32".to_owned() } abi::OsWindows => { - "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32".to_string() + "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32".to_owned() } abi::OsLinux => { - "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string() + "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_owned() } abi::OsAndroid => { - "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string() + "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_owned() } abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => { - "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string() + "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_owned() } }, target_triple: target_triple, - cc_args: vec!("-m32".to_string()), + cc_args: vec!("-m32".to_owned()), }; } diff --git a/src/librustc_back/x86_64.rs b/src/librustc_back/x86_64.rs index d016bd12c698f..db6ca21f14ae3 100644 --- a/src/librustc_back/x86_64.rs +++ b/src/librustc_back/x86_64.rs @@ -14,49 +14,49 @@ use syntax::abi; pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { return target_strs::t { - module_asm: "".to_string(), + module_asm: "".to_owned(), data_layout: match target_os { abi::OsMacos => { "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64".to_string() + s0:64:64-f80:128:128-n8:16:32:64".to_owned() } abi::OsiOS => { "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64".to_string() + s0:64:64-f80:128:128-n8:16:32:64".to_owned() } abi::OsWindows => { // FIXME: Test this. Copied from Linux (#2398) "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string() + s0:64:64-f80:128:128-n8:16:32:64-S128".to_owned() } abi::OsLinux => { "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string() + s0:64:64-f80:128:128-n8:16:32:64-S128".to_owned() } abi::OsAndroid => { "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string() + s0:64:64-f80:128:128-n8:16:32:64-S128".to_owned() } abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => { "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string() + s0:64:64-f80:128:128-n8:16:32:64-S128".to_owned() } }, target_triple: target_triple, - cc_args: vec!("-m64".to_string()), + cc_args: vec!("-m64".to_owned()), }; } diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index 839b39a8ca003..8444dd32c8cc5 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -455,7 +455,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> { }; let ol_pronoun = if new_loan.loan_path == old_loan.loan_path { - "it".to_string() + "it".to_owned() } else { format!("`{}`", ol) }; diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 472aff6625bc7..586db6732d57a 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -846,7 +846,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { } err_out_of_scope(..) => { let msg = match opt_loan_path(&err.cmt) { - None => "borrowed value".to_string(), + None => "borrowed value".to_owned(), Some(lp) => { format!("`{}`", self.loan_path_to_string(&*lp)) } @@ -1159,7 +1159,7 @@ impl<'tcx> Repr<'tcx> for InteriorKind { InteriorField(mc::NamedField(fld)) => format!("{}", token::get_name(fld)), InteriorField(mc::PositionalField(i)) => format!("#{}", i), - InteriorElement(..) => "[]".to_string(), + InteriorElement(..) => "[]".to_owned(), } } } diff --git a/src/librustc_borrowck/graphviz.rs b/src/librustc_borrowck/graphviz.rs index ade52bfde35e6..1b8712bef82f5 100644 --- a/src/librustc_borrowck/graphviz.rs +++ b/src/librustc_borrowck/graphviz.rs @@ -54,7 +54,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> { fn dataflow_for(&self, e: EntryOrExit, n: &Node<'a>) -> String { let id = n.1.data.id(); debug!("dataflow_for({:?}, id={}) {:?}", e, id, self.variants); - let mut sets = "".to_string(); + let mut sets = "".to_owned(); let mut seen_one = false; for &variant in &self.variants { if seen_one { sets.push_str(" "); } else { seen_one = true; } @@ -82,7 +82,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> { F: FnMut(usize) -> Rc>, { let mut saw_some = false; - let mut set = "{".to_string(); + let mut set = "{".to_owned(); dfcx.each_bit_for_node(e, cfgidx, |index| { let lp = to_lp(index); if saw_some { diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 13dec30e0a016..d4eff63f46775 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -165,7 +165,7 @@ pub fn compile_input(sess: Session, /// The name used for source code that doesn't originate in a file /// (e.g. source from stdin or a string) pub fn anon_src() -> String { - "".to_string() + "".to_owned() } pub fn source_name(input: &Input) -> String { @@ -870,7 +870,7 @@ pub fn collect_crate_types(session: &Session, ast::CRATE_NODE_ID, a.span, "invalid `crate_type` \ - value".to_string()); + value".to_owned()); None } _ => { diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 49879b472feb7..9e3c0a5b54130 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -397,7 +397,7 @@ impl RustcDefaultCalls { input: &Input) -> Compilation { let r = matches.opt_strs("Z"); - if r.contains(&("ls".to_string())) { + if r.contains(&("ls".to_owned())) { match input { &Input::File(ref ifile) => { let path = &(*ifile); @@ -746,7 +746,7 @@ pub fn handle_options(mut args: Vec) -> Option { return None; } - if cg_flags.contains(&"passes=list".to_string()) { + if cg_flags.contains(&"passes=list".to_owned()) { unsafe { ::llvm::LLVMRustPrintPasses(); } return None; } @@ -797,7 +797,7 @@ pub fn monitor(f: F) { let data = Arc::new(Mutex::new(Vec::new())); let err = Sink(data.clone()); - let mut cfg = thread::Builder::new().name("rustc".to_string()); + let mut cfg = thread::Builder::new().name("rustc".to_owned()); // FIXME: Hacks on hacks. If the env is trying to override the stack size // then *don't* set it explicitly. @@ -823,7 +823,7 @@ pub fn monitor(f: F) { } let xs = [ - "the compiler unexpectedly panicked. this is a bug.".to_string(), + "the compiler unexpectedly panicked. this is a bug.".to_owned(), format!("we would appreciate a bug report: {}", BUG_REPORT_URL), ]; diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 4678b5335eab7..35e7bbcad48e3 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -759,7 +759,7 @@ impl LintPass for UnusedResults { fn check_must_use(cx: &Context, attrs: &[ast::Attribute], sp: Span) -> bool { for attr in attrs { if attr.check_name("must_use") { - let mut msg = "unused result which must be used".to_string(); + let mut msg = "unused result which must be used".to_owned(); // check for #[must_use="..."] match attr.value_str() { None => {} diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs index aebbe14407380..a3cd41084fb29 100644 --- a/src/librustc_resolve/check_unused.rs +++ b/src/librustc_resolve/check_unused.rs @@ -65,7 +65,7 @@ impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> { self.session.add_lint(lint::builtin::UNUSED_IMPORTS, id, span, - "unused import".to_string()); + "unused import".to_owned()); } let mut def_map = self.def_map.borrow_mut(); @@ -127,7 +127,7 @@ impl<'a, 'b, 'v, 'tcx> Visitor<'v> for UnusedImportCheckVisitor<'a, 'b, 'tcx> { self.session.add_lint(lint::builtin::UNUSED_EXTERN_CRATES, item.id, item.span, - "unused extern crate".to_string()); + "unused extern crate".to_owned()); } } }, @@ -149,7 +149,7 @@ impl<'a, 'b, 'v, 'tcx> Visitor<'v> for UnusedImportCheckVisitor<'a, 'b, 'tcx> { .add_lint(lint::builtin::UNUSED_IMPORTS, item.id, p.span, - "unused import".to_string()); + "unused import".to_owned()); } } } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index ba8680a35cb4b..7495db6236df6 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1020,7 +1020,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { module_to_string(&*self.current_module); let prefix = if target_mod_str == current_mod_str { - "self::".to_string() + "self::".to_owned() } else { format!("{}::", target_mod_str) }; @@ -2367,7 +2367,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { maybe_qself.is_none() && path.segments[0].identifier.name == self_type_name; let msg = if is_invalid_self_type_name { - "use of `Self` outside of an impl or trait".to_string() + "use of `Self` outside of an impl or trait".to_owned() } else { format!("use of undeclared {} `{}`", kind, path_names_to_string(path, 0)) @@ -2773,7 +2773,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { self.session .add_lint(lint::builtin::UNUSED_QUALIFICATIONS, id, span, - "unnecessary qualification".to_string()); + "unnecessary qualification".to_owned()); } _ => {} } @@ -3358,7 +3358,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { // limit search to 5 to reduce the number // of stupid suggestions self.find_best_match_for_name(&path_name) - .map_or("".to_string(), + .map_or("".to_owned(), |x| format!("`{}`", x)) } Field => format!("`self.{}`", path_name), @@ -3600,18 +3600,18 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { for (&name, import_resolution) in &*import_resolutions { let value_repr; match import_resolution.target_for_namespace(ValueNS) { - None => { value_repr = "".to_string(); } + None => { value_repr = "".to_owned(); } Some(_) => { - value_repr = " value:?".to_string(); + value_repr = " value:?".to_owned(); // FIXME #4954 } } let type_repr; match import_resolution.target_for_namespace(TypeNS) { - None => { type_repr = "".to_string(); } + None => { type_repr = "".to_owned(); } Some(_) => { - type_repr = " type:?".to_string(); + type_repr = " type:?".to_owned(); // FIXME #4954 } } @@ -3665,7 +3665,7 @@ fn module_to_string(module: &Module) -> String { collect_mod(&mut names, module); if names.is_empty() { - return "???".to_string(); + return "???".to_owned(); } names_to_string(&names.into_iter().rev().collect::>()) } diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 9870b41e7fa63..537106d474b12 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -1015,7 +1015,7 @@ fn import_directive_subclass_to_string(subclass: ImportDirectiveSubclass) -> Str SingleImport(_, source) => { token::get_name(source).to_string() } - GlobImport => "*".to_string() + GlobImport => "*".to_owned() } } diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index 3de91d58740b8..1b34d1928bd0f 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -171,7 +171,7 @@ pub fn find_crate_name(sess: Option<&Session>, } } - "rust_out".to_string() + "rust_out".to_owned() } pub fn build_link_meta(sess: &Session, krate: &ast::Crate, diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index 5352c61d8c0ad..ba1b96b3fa15f 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -647,7 +647,7 @@ pub fn run_passes(sess: &Session, trans.metadata_module, metadata_config.clone(), crate_output.clone(), - "metadata".to_string()); + "metadata".to_owned()); work_items.push(work); } diff --git a/src/librustc_trans/save/dump_csv.rs b/src/librustc_trans/save/dump_csv.rs index 30c72d68fb0e8..0a5c684e2d958 100644 --- a/src/librustc_trans/save/dump_csv.rs +++ b/src/librustc_trans/save/dump_csv.rs @@ -1395,7 +1395,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> { let value = if immut == ast::MutImmutable { self.span.snippet(p.span).to_string() } else { - "".to_string() + "".to_owned() }; assert!(p.segments.len() == 1, "qualified path for local variable def in arm"); @@ -1449,7 +1449,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> { let value = if immut == ast::MutImmutable { value.to_string() } else { - "".to_string() + "".to_owned() }; let types = self.analysis.ty_cx.node_types(); let typ = ppaux::ty_to_string(&self.analysis.ty_cx, *types.get(&id).unwrap()); diff --git a/src/librustc_trans/save/recorder.rs b/src/librustc_trans/save/recorder.rs index c7759f4266ba5..43f7810c4d55f 100644 --- a/src/librustc_trans/save/recorder.rs +++ b/src/librustc_trans/save/recorder.rs @@ -549,7 +549,7 @@ impl<'a> FmtStrs<'a> { }; let (dcn, dck) = match declid { Some(declid) => (s!(declid.node), s!(declid.krate)), - None => ("".to_string(), "".to_string()) + None => ("".to_owned(), "".to_owned()) }; self.check_and_record(MethodCall, span, diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index 390c0b035fdd5..fb64301b01209 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -1174,7 +1174,7 @@ pub fn new_fn_ctxt<'a, 'tcx>(ccx: &'a CrateContext<'a, 'tcx>, debug!("new_fn_ctxt(path={}, id={}, param_substs={})", if id == !0 { - "".to_string() + "".to_owned() } else { ccx.tcx().map.path_to_string(id).to_string() }, @@ -2735,13 +2735,13 @@ pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>) // symbol. This symbol is required for use by the libmorestack library that // we link in, so we must ensure that this symbol is not internalized (if // defined in the crate). - reachable.push("main".to_string()); - reachable.push("rust_stack_exhausted".to_string()); + reachable.push("main".to_owned()); + reachable.push("rust_stack_exhausted".to_owned()); // referenced from .eh_frame section on some platforms - reachable.push("rust_eh_personality".to_string()); + reachable.push("rust_eh_personality".to_owned()); // referenced from rt/rust_try.ll - reachable.push("rust_eh_personality_catch".to_string()); + reachable.push("rust_eh_personality_catch".to_owned()); if codegen_units > 1 { internalize_symbols(&shared_ccx, &reachable.iter().cloned().collect()); diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/trans/callee.rs index 31c9b60f478a2..0035837b793d5 100644 --- a/src/librustc_trans/trans/callee.rs +++ b/src/librustc_trans/trans/callee.rs @@ -491,7 +491,7 @@ pub fn trans_fn_ref_with_substs<'a, 'tcx>( let map_node = session::expect( ccx.sess(), tcx.map.find(def_id.node), - || "local item should be in ast map".to_string()); + || "local item should be in ast map".to_owned()); match map_node { ast_map::NodeVariant(v) => match v.node.kind { diff --git a/src/librustc_trans/trans/debuginfo/metadata.rs b/src/librustc_trans/trans/debuginfo/metadata.rs index ab86cd7cdde59..99fcb768444ef 100644 --- a/src/librustc_trans/trans/debuginfo/metadata.rs +++ b/src/librustc_trans/trans/debuginfo/metadata.rs @@ -581,14 +581,14 @@ fn vec_slice_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, element_type)); let member_descriptions = [ MemberDescription { - name: "data_ptr".to_string(), + name: "data_ptr".to_owned(), llvm_type: member_llvm_types[0], type_metadata: element_type_metadata, offset: ComputedMemberOffset, flags: FLAGS_NONE }, MemberDescription { - name: "length".to_string(), + name: "length".to_owned(), llvm_type: member_llvm_types[1], type_metadata: type_metadata(cx, cx.tcx().types.usize, span), offset: ComputedMemberOffset, @@ -936,26 +936,26 @@ fn basic_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, let (name, encoding) = match t.sty { ty::ty_tup(ref elements) if elements.is_empty() => - ("()".to_string(), DW_ATE_unsigned), - ty::ty_bool => ("bool".to_string(), DW_ATE_boolean), - ty::ty_char => ("char".to_string(), DW_ATE_unsigned_char), + ("()".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_int(int_ty) => match int_ty { - ast::TyIs => ("isize".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) + ast::TyIs => ("isize".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) }, ty::ty_uint(uint_ty) => match uint_ty { - ast::TyUs => ("usize".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) + ast::TyUs => ("usize".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) }, ty::ty_float(float_ty) => match float_ty { - ast::TyF32 => ("f32".to_string(), DW_ATE_float), - ast::TyF64 => ("f64".to_string(), DW_ATE_float), + ast::TyF32 => ("f32".to_owned(), DW_ATE_float), + ast::TyF64 => ("f64".to_owned(), DW_ATE_float), }, _ => cx.sess().bug("debuginfo::basic_type_metadata - t is invalid type") }; @@ -1303,7 +1303,7 @@ impl<'tcx> EnumMemberDescriptionFactory<'tcx> { variant_llvm_type, &member_descriptions); MemberDescription { - name: "".to_string(), + name: "".to_owned(), llvm_type: variant_llvm_type, type_metadata: variant_type_metadata, offset: FixedMemberOffset { bytes: 0 }, @@ -1337,7 +1337,7 @@ impl<'tcx> EnumMemberDescriptionFactory<'tcx> { &member_descriptions[..]); vec![ MemberDescription { - name: "".to_string(), + name: "".to_owned(), llvm_type: variant_llvm_type, type_metadata: variant_type_metadata, offset: FixedMemberOffset { bytes: 0 }, @@ -1369,7 +1369,7 @@ impl<'tcx> EnumMemberDescriptionFactory<'tcx> { let sole_struct_member_description = MemberDescription { name: match non_null_variant.arg_names { Some(ref names) => token::get_name(names[0]).to_string(), - None => "__0".to_string() + None => "__0".to_owned() }, llvm_type: non_null_llvm_type, type_metadata: non_null_type_metadata, @@ -1550,7 +1550,7 @@ fn describe_enum_variant<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, // If this is not a univariant enum, there is also the discriminant field. match discriminant_info { - RegularDiscriminant(_) => arg_names.insert(0, "RUST$ENUM$DISR".to_string()), + RegularDiscriminant(_) => arg_names.insert(0, "RUST$ENUM$DISR".to_owned()), _ => { /* do nothing */ } }; diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs index e9804a11f2c8c..fadee80c4e703 100644 --- a/src/librustc_trans/trans/expr.rs +++ b/src/librustc_trans/trans/expr.rs @@ -104,7 +104,7 @@ impl Dest { pub fn to_string(&self, ccx: &CrateContext) -> String { match *self { SaveIn(v) => format!("SaveIn({})", ccx.tn().val_to_string(v)), - Ignore => "Ignore".to_string() + Ignore => "Ignore".to_owned() } } } diff --git a/src/librustc_trans/trans/foreign.rs b/src/librustc_trans/trans/foreign.rs index 95c93d76585bf..a3a1579409a3c 100644 --- a/src/librustc_trans/trans/foreign.rs +++ b/src/librustc_trans/trans/foreign.rs @@ -145,7 +145,7 @@ pub fn register_static(ccx: &CrateContext, // linkage and there are no definitions), then // `extern_with_linkage_foo` will instead be initialized to // zero. - let mut real_name = "_rust_extern_with_linkage_".to_string(); + let mut real_name = "_rust_extern_with_linkage_".to_owned(); real_name.push_str(&ident); let g2 = declare::define_global(ccx, &real_name[..], llty).unwrap_or_else(||{ ccx.sess().span_fatal(foreign_item.span, diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 0c756cf50083f..02d85b59fb503 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -116,7 +116,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>, // Check that the types of the end-points can be unified. let types_unify = require_same_types( tcx, Some(fcx.infcx()), false, pat.span, rhs_ty, lhs_ty, - || "mismatched types in range".to_string() + || "mismatched types in range".to_owned() ); // It's ok to return without a message as `require_same_types` prints an error. diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 6f97239ae939e..387736016a88c 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -4055,7 +4055,7 @@ fn check_block_with_expected<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, .add_lint(lint::builtin::UNREACHABLE_CODE, s_id, s.span, - "unreachable statement".to_string()); + "unreachable statement".to_owned()); warned = true; } any_diverges = any_diverges || fcx.infcx().type_var_diverges(s_ty); @@ -4077,7 +4077,7 @@ fn check_block_with_expected<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, .add_lint(lint::builtin::UNREACHABLE_CODE, e.id, e.span, - "unreachable expression".to_string()); + "unreachable expression".to_owned()); } let ety = match expected { ExpectHasType(ety) => { @@ -4894,7 +4894,7 @@ fn structurally_resolve_type_or_else<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>, // If not, error. if ty::type_is_ty_var(alternative) || ty::type_is_error(alternative) { fcx.type_error_message(sp, |_actual| { - "the type of this value must be known in this context".to_string() + "the type of this value must be known in this context".to_owned() }, ty, None); demand::suptype(fcx, sp, fcx.tcx().types.err, ty); ty = fcx.tcx().types.err; diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 10bae6f63d0d5..064ec078bc6a9 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -127,7 +127,7 @@ struct Dog { age: u32 } -let d = Dog { name: "Rusty".to_string(), age: 8 }; +let d = Dog { name: "Rusty".to_owned(), age: 8 }; // This is incorrect. match d { diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index cd8d7b416d239..c4ba49742e558 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -488,7 +488,7 @@ fn build_static(cx: &DocContext, tcx: &ty::ctxt, clean::Static { type_: ty::lookup_item_type(tcx, did).ty.clean(cx), mutability: if mutable {clean::Mutable} else {clean::Immutable}, - expr: "\n\n\n".to_string(), // trigger the "[definition]" links + expr: "\n\n\n".to_owned(), // trigger the "[definition]" links } } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index af0c3a1c02aa1..eff8a13c0adcc 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -322,7 +322,7 @@ impl Item { match self.stability { Some(ref s) => { let mut base = match s.level { - attr::Unstable => "unstable".to_string(), + attr::Unstable => "unstable".to_owned(), attr::Stable => String::new(), }; if !s.deprecated_since.is_empty() { @@ -377,7 +377,7 @@ impl Clean for doctree::Module { let name = if self.name.is_some() { self.name.unwrap().clean(cx) } else { - "".to_string() + "".to_owned() }; let mut items: Vec = vec![]; @@ -754,7 +754,7 @@ impl Lifetime { } pub fn statik() -> Lifetime { - Lifetime("'static".to_string()) + Lifetime("'static".to_owned()) } } @@ -1159,7 +1159,7 @@ impl<'a, 'tcx> Clean for (ast::DefId, &'a ty::PolyFnSig<'tcx>) { Argument { type_: t.clean(cx), id: 0, - name: names.next().unwrap_or("".to_string()), + name: names.next().unwrap_or("".to_owned()), } }).collect(), }, @@ -1953,7 +1953,7 @@ pub struct Span { impl Span { fn empty() -> Span { Span { - filename: "".to_string(), + filename: "".to_owned(), loline: 0, locol: 0, hiline: 0, hicol: 0, } @@ -2446,7 +2446,7 @@ impl Clean for ast::PathListItem { source: resolve_def(cx, id) }, ast::PathListMod { id } => ViewListIdent { - name: "self".to_string(), + name: "self".to_owned(), source: resolve_def(cx, id) } } @@ -2482,7 +2482,7 @@ impl Clean for ast::ForeignItem { ForeignStaticItem(Static { type_: ty.clean(cx), mutability: if mutbl {Mutable} else {Immutable}, - expr: "".to_string(), + expr: "".to_owned(), }) } }; @@ -2509,7 +2509,7 @@ impl ToSource for syntax::codemap::Span { debug!("converting span {:?} to snippet", self.clean(cx)); let sn = match cx.sess().codemap().span_to_snippet(*self) { Ok(x) => x.to_string(), - Err(_) => "".to_string() + Err(_) => "".to_owned() }; debug!("got snippet {}", sn); sn @@ -2541,8 +2541,8 @@ fn name_from_pat(p: &ast::Pat) -> String { debug!("Trying to get a name from pattern: {:?}", p); match p.node { - PatWild(PatWildSingle) => "_".to_string(), - PatWild(PatWildMulti) => "..".to_string(), + PatWild(PatWildSingle) => "_".to_owned(), + PatWild(PatWildMulti) => "..".to_owned(), PatIdent(_, ref p, _) => token::get_ident(p.node).to_string(), PatEnum(ref p, _) => path_to_string(p), PatQPath(..) => panic!("tried to get argument name from PatQPath, \ @@ -2562,7 +2562,7 @@ fn name_from_pat(p: &ast::Pat) -> String { PatLit(..) => { warn!("tried to get argument name from PatLit, \ which is silly in function arguments"); - "()".to_string() + "()".to_owned() }, PatRange(..) => panic!("tried to get argument name from PatRange, \ which is not allowed in function arguments"), @@ -2575,7 +2575,7 @@ fn name_from_pat(p: &ast::Pat) -> String { PatMac(..) => { warn!("can't document the name of a function argument \ produced by a pattern macro"); - "(argument produced by macro)".to_string() + "(argument produced by macro)".to_owned() } } } @@ -2698,11 +2698,11 @@ impl Clean for attr::Stability { Stability { level: self.level, feature: self.feature.to_string(), - since: self.since.as_ref().map_or("".to_string(), + since: self.since.as_ref().map_or("".to_owned(), |interned| interned.to_string()), - deprecated_since: self.deprecated_since.as_ref().map_or("".to_string(), + deprecated_since: self.deprecated_since.as_ref().map_or("".to_owned(), |istr| istr.to_string()), - reason: self.reason.as_ref().map_or("".to_string(), + reason: self.reason.as_ref().map_or("".to_owned(), |interned| interned.to_string()), } } @@ -2713,11 +2713,11 @@ impl<'a> Clean for &'a attr::Stability { Stability { level: self.level, feature: self.feature.to_string(), - since: self.since.as_ref().map_or("".to_string(), + since: self.since.as_ref().map_or("".to_owned(), |interned| interned.to_string()), - deprecated_since: self.deprecated_since.as_ref().map_or("".to_string(), + deprecated_since: self.deprecated_since.as_ref().map_or("".to_owned(), |istr| istr.to_string()), - reason: self.reason.as_ref().map_or("".to_string(), + reason: self.reason.as_ref().map_or("".to_owned(), |interned| interned.to_string()), } } diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 9439fc3c5f405..f5a3912fd9fa1 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -328,7 +328,7 @@ fn resolved_path(w: &mut fmt::Formatter, did: ast::DefId, path: &clean::Path, print_all: bool) -> fmt::Result { let last = path.segments.last().unwrap(); let rel_root = match &*path.segments[0].name { - "self" => Some("./".to_string()), + "self" => Some("./".to_owned()), _ => None, }; @@ -447,8 +447,8 @@ impl fmt::Display for clean::Type { write!(f, "{}{}fn{}{}", UnsafetySpace(decl.unsafety), match &*decl.abi { - "" => " extern ".to_string(), - "\"Rust\"" => "".to_string(), + "" => " extern ".to_owned(), + "\"Rust\"" => "".to_owned(), s => format!(" extern {} ", s) }, decl.generics, @@ -476,7 +476,7 @@ impl fmt::Display for clean::Type { clean::BorrowedRef{ lifetime: ref l, mutability, type_: ref ty} => { let lt = match *l { Some(ref l) => format!("{} ", *l), - _ => "".to_string(), + _ => "".to_owned(), }; let m = MutableSpace(mutability); match **ty { diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index e375ec3afc254..f0e92306b752d 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -25,7 +25,7 @@ use syntax::parse; pub fn highlight(src: &str, class: Option<&str>, id: Option<&str>) -> String { debug!("highlighting: ================\n{}\n==============", src); let sess = parse::ParseSess::new(); - let fm = sess.codemap().new_filemap("".to_string(), src.to_string()); + let fm = sess.codemap().new_filemap("".to_owned(), src.to_string()); let mut out = Vec::new(); doit(&sess, diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index 798cc6a612cde..ecc63dab1536e 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -135,7 +135,7 @@ r##" root_path = page.root_path, ty = page.ty, logo = if layout.logo.is_empty() { - "".to_string() + "".to_owned() } else { format!("\ ", @@ -146,7 +146,7 @@ r##" description = page.description, keywords = page.keywords, favicon = if layout.favicon.is_empty() { - "".to_string() + "".to_owned() } else { format!(r#""#, layout.favicon) }, @@ -157,7 +157,7 @@ r##" krate = layout.krate, play_url = layout.playground_url, play_js = if layout.playground_url.is_empty() { - "".to_string() + "".to_owned() } else { format!(r#""#, page.root_path) }, diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 4982215d02f49..87ac28b2ae8be 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -267,7 +267,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_string() + "".to_owned() } else { let s = unsafe { (*text).as_bytes() }; str::from_utf8(s).unwrap().to_string() @@ -319,7 +319,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result { extern fn codespan(ob: *mut hoedown_buffer, text: *const hoedown_buffer, _: *mut libc::c_void) { let content = if text.is_null() { - "".to_string() + "".to_owned() } else { let bytes = unsafe { (*text).as_bytes() }; let s = str::from_utf8(bytes).unwrap(); @@ -546,7 +546,7 @@ pub fn plain_summary_line(md: &str) -> String { let plain_slice = (*ob).as_bytes(); let plain = match str::from_utf8(plain_slice) { Ok(s) => s.to_string(), - Err(_) => "".to_string(), + Err(_) => "".to_owned(), }; hoedown_buffer_free(ob); plain diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index cbf521840ae27..435372955c673 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -318,11 +318,11 @@ pub fn run(mut krate: clean::Crate, current: Vec::new(), root_path: String::new(), layout: layout::Layout { - logo: "".to_string(), - favicon: "".to_string(), + logo: "".to_owned(), + favicon: "".to_owned(), external_html: external_html.clone(), krate: krate.name.clone(), - playground_url: "".to_string(), + playground_url: "".to_owned(), }, include_sources: true, render_redirect_pages: false, @@ -490,7 +490,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::Result { let mut w = io::Cursor::new(Vec::new()); try!(write!(&mut w, r#"searchIndex['{}'] = {{"items":["#, krate.name)); - let mut lastpath = "".to_string(); + let mut lastpath = "".to_owned(); for (i, item) in cache.search_index.iter().enumerate() { // Omit the path if it is same to that of the prior item. let path; @@ -673,7 +673,7 @@ fn render_sources(cx: &mut Context, cx: cx, }; // skip all invalid spans - folder.seen.insert("".to_string()); + folder.seen.insert("".to_owned()); Ok(folder.fold_crate(krate)) } @@ -1534,7 +1534,7 @@ fn shorter<'a>(s: Option<&'a str>) -> String { !chr.is_whitespace() }) }).collect::>().connect("\n"), - None => "".to_string() + None => "".to_owned() } } diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs index 8f3e63820dac9..42ebda4acf689 100644 --- a/src/librustdoc/html/toc.rs +++ b/src/librustdoc/html/toc.rs @@ -212,7 +212,7 @@ mod tests { ($level: expr, $name: expr) => { assert_eq!(builder.push($level, $name.to_string(), - "".to_string()), + "".to_owned()), $name); } } @@ -253,7 +253,7 @@ mod tests { level: $level, name: $name.to_string(), sec_number: $name.to_string(), - id: "".to_string(), + id: "".to_owned(), children: toc!($($sub),*) } ),* diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 38cc120698431..2998ed9dfc68f 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -335,13 +335,13 @@ fn parse_externs(matches: &getopts::Matches) -> Result { let name = match parts.next() { Some(s) => s, None => { - return Err("--extern value must not be empty".to_string()); + return Err("--extern value must not be empty".to_owned()); } }; let location = match parts.next() { Some(s) => s, None => { - return Err("--extern value must be of the format `foo=bar`".to_string()); + return Err("--extern value must be of the format `foo=bar`".to_owned()); } }; let name = name.to_string(); @@ -427,7 +427,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche // Load all plugins/passes into a PluginManager let path = matches.opt_str("plugin-path") - .unwrap_or("/tmp/rustdoc/plugins".to_string()); + .unwrap_or("/tmp/rustdoc/plugins".to_owned()); let mut pm = plugins::PluginManager::new(PathBuf::from(path)); for pass in &passes { let plugin = match PASSES.iter() @@ -466,7 +466,7 @@ fn json_input(input: &str) -> Result { Ok(Json::Object(obj)) => { let mut obj = obj; // Make sure the schema is what we expect - match obj.remove(&"schema".to_string()) { + match obj.remove(&"schema".to_owned()) { Some(Json::String(version)) => { if version != SCHEMA_VERSION { return Err(format!( @@ -474,15 +474,15 @@ fn json_input(input: &str) -> Result { SCHEMA_VERSION)) } } - Some(..) => return Err("malformed json".to_string()), - None => return Err("expected a schema version".to_string()), + Some(..) => return Err("malformed json".to_owned()), + None => return Err("expected a schema version".to_owned()), } - let krate = match obj.remove(&"crate".to_string()) { + let krate = match obj.remove(&"crate".to_owned()) { Some(json) => { let mut d = json::Decoder::new(json); Decodable::decode(&mut d).unwrap() } - None => return Err("malformed json".to_string()), + None => return Err("malformed json".to_owned()), }; // FIXME: this should read from the "plugins" field, but currently // Json doesn't implement decodable... @@ -491,7 +491,7 @@ fn json_input(input: &str) -> Result { } Ok(..) => { Err("malformed json input: expected an object at the \ - top".to_string()) + top".to_owned()) } } } @@ -506,7 +506,7 @@ fn json_output(krate: clean::Crate, res: Vec , // "plugins": { output of plugins ... } // } let mut json = std::collections::BTreeMap::new(); - json.insert("schema".to_string(), Json::String(SCHEMA_VERSION.to_string())); + json.insert("schema".to_owned(), Json::String(SCHEMA_VERSION.to_string())); let plugins_json = res.into_iter() .filter_map(|opt| { match opt { @@ -525,8 +525,8 @@ fn json_output(krate: clean::Crate, res: Vec , Err(e) => panic!("Rust generated JSON is invalid: {:?}", e) }; - json.insert("crate".to_string(), crate_json); - json.insert("plugins".to_string(), Json::Object(plugins_json)); + json.insert("crate".to_owned(), crate_json); + json.insert("plugins".to_owned(), Json::Object(plugins_json)); let mut file = try!(File::create(&dst)); write!(&mut file, "{}", Json::Object(json)) diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index 00de4e3ec53cf..8304997b70896 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -61,7 +61,7 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches, if playground.is_some() { markdown::PLAYGROUND_KRATE.with(|s| { *s.borrow_mut() = Some(None); }); } - let playground = playground.unwrap_or("".to_string()); + let playground = playground.unwrap_or("".to_owned()); let mut out = match File::create(&output) { Err(e) => { @@ -149,7 +149,7 @@ pub fn test(input: &str, libs: SearchPaths, externs: core::Externs, let mut collector = Collector::new(input.to_string(), libs, externs, true, opts); find_testable_code(&input_str, &mut collector); - test_args.insert(0, "rustdoctest".to_string()); + test_args.insert(0, "rustdoctest".to_owned()); testing::test_main(&test_args, collector.tests); 0 } diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs index 74c16127f41cc..158508bdea46f 100644 --- a/src/librustdoc/passes.rs +++ b/src/librustdoc/passes.rs @@ -260,7 +260,7 @@ pub fn unindent_comments(krate: clean::Crate) -> plugins::PluginResult { match attr { &clean::NameValue(ref x, ref s) if "doc" == *x => { - avec.push(clean::NameValue("doc".to_string(), + avec.push(clean::NameValue("doc".to_owned(), unindent(s))) } x => avec.push(x.clone()) @@ -296,7 +296,7 @@ pub fn collapse_docs(krate: clean::Crate) -> plugins::PluginResult { _ => true }).cloned().collect(); if !docstr.is_empty() { - a.push(clean::NameValue("doc".to_string(), docstr)); + a.push(clean::NameValue("doc".to_owned(), docstr)); } i.attrs = a; self.fold_item_recur(i) @@ -373,14 +373,14 @@ mod unindent_tests { #[test] fn should_unindent() { - let s = " line1\n line2".to_string(); + let s = " line1\n line2".to_owned(); let r = unindent(&s); assert_eq!(r, "line1\nline2"); } #[test] fn should_unindent_multiple_paragraphs() { - let s = " line1\n\n line2".to_string(); + let s = " line1\n\n line2".to_owned(); let r = unindent(&s); assert_eq!(r, "line1\n\nline2"); } @@ -389,7 +389,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_string(); + let s = " line1\n\n line2".to_owned(); let r = unindent(&s); assert_eq!(r, "line1\n\n line2"); } @@ -401,14 +401,14 @@ mod unindent_tests { // // #[doc = "Start way over here // and continue here"] - let s = "line1\n line2".to_string(); + let s = "line1\n line2".to_owned(); let r = unindent(&s); assert_eq!(r, "line1\nline2"); } #[test] fn should_not_ignore_first_line_indent_in_a_single_line_para() { - let s = "line1\n\n line2".to_string(); + let s = "line1\n\n line2".to_owned(); let r = unindent(&s); assert_eq!(r, "line1\n\n line2"); } diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 8e2a3e6fcc3a1..b9690588ce7e6 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -112,7 +112,7 @@ pub fn run(input: &str, opts); collector.fold_crate(krate); - test_args.insert(0, "rustdoctest".to_string()); + test_args.insert(0, "rustdoctest".to_owned()); testing::test_main(&test_args, collector.tests.into_iter().collect()); diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 0096d8d22ae8a..409cedb38b474 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -92,7 +92,7 @@ //! fn main() { //! let object = TestStruct { //! data_int: 1, -//! data_str: "homura".to_string(), +//! data_str: "homura".to_owned(), //! data_vector: vec![2,3,4,5], //! }; //! @@ -141,7 +141,7 @@ //! let num = ComplexNum { a: 0.0001, b: 12.539 }; //! let data: String = json::encode(&ComplexNumRecord{ //! uid: 1, -//! dsc: "test".to_string(), +//! dsc: "test".to_owned(), //! val: num.to_json(), //! }).unwrap(); //! println!("data: {}", data); @@ -170,9 +170,9 @@ //! fn to_json(&self) -> Json { //! let mut d = BTreeMap::new(); //! // All standard types implement `to_json()`, so use it -//! d.insert("data_int".to_string(), self.data_int.to_json()); -//! d.insert("data_str".to_string(), self.data_str.to_json()); -//! d.insert("data_vector".to_string(), self.data_vector.to_json()); +//! d.insert("data_int".to_owned(), self.data_int.to_json()); +//! d.insert("data_str".to_owned(), self.data_str.to_json()); +//! d.insert("data_vector".to_owned(), self.data_vector.to_json()); //! Json::Object(d) //! } //! } @@ -181,7 +181,7 @@ //! // Serialize using `ToJson` //! let input_data = TestStruct { //! data_int: 1, -//! data_str: "madoka".to_string(), +//! data_str: "madoka".to_owned(), //! data_vector: vec![2,3,4,5], //! }; //! let json_obj: Json = input_data.to_json(); @@ -2100,7 +2100,7 @@ macro_rules! expect { ($e:expr, Null) => ({ match $e { Json::Null => Ok(()), - other => Err(ExpectedError("Null".to_string(), + other => Err(ExpectedError("Null".to_owned(), format!("{}", other))) } }); @@ -2121,14 +2121,14 @@ macro_rules! read_primitive { match self.pop() { Json::I64(f) => Ok(f as $ty), Json::U64(f) => Ok(f as $ty), - Json::F64(f) => Err(ExpectedError("Integer".to_string(), format!("{}", f))), + Json::F64(f) => Err(ExpectedError("Integer".to_owned(), format!("{}", f))), // re: #12967.. a type w/ numeric keys (ie HashMap etc) // is going to have a string here, as per JSON spec. Json::String(s) => match s.parse().ok() { Some(f) => Ok(f), - None => Err(ExpectedError("Number".to_string(), s)), + None => Err(ExpectedError("Number".to_owned(), s)), }, - value => Err(ExpectedError("Number".to_string(), format!("{}", value))), + value => Err(ExpectedError("Number".to_owned(), format!("{}", value))), } } } @@ -2164,11 +2164,11 @@ impl ::Decoder for Decoder { // is going to have a string here, as per JSON spec. match s.parse().ok() { Some(f) => Ok(f), - None => Err(ExpectedError("Number".to_string(), s)), + None => Err(ExpectedError("Number".to_owned(), s)), } }, Json::Null => Ok(f64::NAN), - value => Err(ExpectedError("Number".to_string(), format!("{}", value))) + value => Err(ExpectedError("Number".to_owned(), format!("{}", value))) } } @@ -2186,7 +2186,7 @@ impl ::Decoder for Decoder { _ => () } } - Err(ExpectedError("single character string".to_string(), format!("{}", s))) + Err(ExpectedError("single character string".to_owned(), format!("{}", s))) } fn read_str(&mut self) -> DecodeResult { @@ -2206,32 +2206,32 @@ impl ::Decoder for Decoder { let name = match self.pop() { Json::String(s) => s, Json::Object(mut o) => { - let n = match o.remove(&"variant".to_string()) { + let n = match o.remove(&"variant".to_owned()) { Some(Json::String(s)) => s, Some(val) => { - return Err(ExpectedError("String".to_string(), format!("{}", val))) + return Err(ExpectedError("String".to_owned(), format!("{}", val))) } None => { - return Err(MissingFieldError("variant".to_string())) + return Err(MissingFieldError("variant".to_owned())) } }; - match o.remove(&"fields".to_string()) { + match o.remove(&"fields".to_owned()) { Some(Json::Array(l)) => { for field in l.into_iter().rev() { self.stack.push(field); } }, Some(val) => { - return Err(ExpectedError("Array".to_string(), format!("{}", val))) + return Err(ExpectedError("Array".to_owned(), format!("{}", val))) } None => { - return Err(MissingFieldError("fields".to_string())) + return Err(MissingFieldError("fields".to_owned())) } } n } json => { - return Err(ExpectedError("String or Object".to_string(), format!("{}", json))) + return Err(ExpectedError("String or Object".to_owned(), format!("{}", json))) } }; let idx = match names.iter().position(|n| *n == &name[..]) { @@ -2645,9 +2645,9 @@ mod tests { #[test] fn test_decode_option_malformed() { check_err::("{ \"opt\": [] }", - ExpectedError("Number".to_string(), "[]".to_string())); + ExpectedError("Number".to_owned(), "[]".to_owned())); check_err::("{ \"opt\": false }", - ExpectedError("Number".to_string(), "false".to_string())); + ExpectedError("Number".to_owned(), "false".to_owned())); } #[derive(PartialEq, RustcEncodable, RustcDecodable, Debug)] @@ -2733,11 +2733,11 @@ mod tests { #[test] fn test_write_str() { - assert_eq!(String("".to_string()).to_string(), "\"\""); - assert_eq!(String("".to_string()).pretty().to_string(), "\"\""); + assert_eq!(String("".to_owned()).to_string(), "\"\""); + assert_eq!(String("".to_owned()).pretty().to_string(), "\"\""); - assert_eq!(String("homura".to_string()).to_string(), "\"homura\""); - assert_eq!(String("madoka".to_string()).pretty().to_string(), "\"madoka\""); + assert_eq!(String("homura".to_owned()).to_string(), "\"homura\""); + assert_eq!(String("madoka".to_owned()).pretty().to_string(), "\"madoka\""); } #[test] @@ -2766,7 +2766,7 @@ mod tests { let long_test_array = Array(vec![ Boolean(false), Null, - Array(vec![String("foo\nbar".to_string()), F64(3.5)])]); + Array(vec![String("foo\nbar".to_owned()), F64(3.5)])]); assert_eq!(long_test_array.to_string(), "[false,null,[\"foo\\nbar\",3.5]]"); @@ -2791,12 +2791,12 @@ mod tests { assert_eq!( mk_object(&[ - ("a".to_string(), Boolean(true)) + ("a".to_owned(), Boolean(true)) ]).to_string(), "{\"a\":true}" ); assert_eq!( - mk_object(&[("a".to_string(), Boolean(true))]).pretty().to_string(), + mk_object(&[("a".to_owned(), Boolean(true))]).pretty().to_string(), "\ {\n \ \"a\": true\n\ @@ -2804,9 +2804,9 @@ mod tests { ); let complex_obj = mk_object(&[ - ("b".to_string(), Array(vec![ - mk_object(&[("c".to_string(), String("\x0c\r".to_string()))]), - mk_object(&[("d".to_string(), String("".to_string()))]) + ("b".to_owned(), Array(vec![ + mk_object(&[("c".to_owned(), String("\x0c\r".to_owned()))]), + mk_object(&[("d".to_owned(), String("".to_owned()))]) ])) ]); @@ -2835,10 +2835,10 @@ mod tests { ); let a = mk_object(&[ - ("a".to_string(), Boolean(true)), - ("b".to_string(), Array(vec![ - mk_object(&[("c".to_string(), String("\x0c\r".to_string()))]), - mk_object(&[("d".to_string(), String("".to_string()))]) + ("a".to_owned(), Boolean(true)), + ("b".to_owned(), Array(vec![ + mk_object(&[("c".to_owned(), String("\x0c\r".to_owned()))]), + mk_object(&[("d".to_owned(), String("".to_owned()))]) ])) ]); @@ -2860,7 +2860,7 @@ mod tests { "\"Dog\"" ); - let animal = Frog("Henry".to_string(), 349); + let animal = Frog("Henry".to_owned(), 349); assert_eq!( format!("{}", super::as_json(&animal)), "{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}" @@ -2889,7 +2889,7 @@ mod tests { #[test] fn test_write_some() { - check_encoder_for_simple!(Some("jodhpurs".to_string()), "\"jodhpurs\""); + check_encoder_for_simple!(Some("jodhpurs".to_owned()), "\"jodhpurs\""); } #[test] @@ -3012,8 +3012,8 @@ mod tests { assert_eq!(v, i64::MAX); let res: DecodeResult = super::decode("765.25"); - assert_eq!(res, Err(ExpectedError("Integer".to_string(), - "765.25".to_string()))); + assert_eq!(res, Err(ExpectedError("Integer".to_owned(), + "765.25".to_owned()))); } #[test] @@ -3021,16 +3021,16 @@ mod tests { assert_eq!(from_str("\""), Err(SyntaxError(EOFWhileParsingString, 1, 2))); assert_eq!(from_str("\"lol"), Err(SyntaxError(EOFWhileParsingString, 1, 5))); - assert_eq!(from_str("\"\""), Ok(String("".to_string()))); - assert_eq!(from_str("\"foo\""), Ok(String("foo".to_string()))); - assert_eq!(from_str("\"\\\"\""), Ok(String("\"".to_string()))); - assert_eq!(from_str("\"\\b\""), Ok(String("\x08".to_string()))); - assert_eq!(from_str("\"\\n\""), Ok(String("\n".to_string()))); - assert_eq!(from_str("\"\\r\""), Ok(String("\r".to_string()))); - assert_eq!(from_str("\"\\t\""), Ok(String("\t".to_string()))); - assert_eq!(from_str(" \"foo\" "), Ok(String("foo".to_string()))); - assert_eq!(from_str("\"\\u12ab\""), Ok(String("\u{12ab}".to_string()))); - assert_eq!(from_str("\"\\uAB12\""), Ok(String("\u{AB12}".to_string()))); + assert_eq!(from_str("\"\""), Ok(String("".to_owned()))); + assert_eq!(from_str("\"foo\""), Ok(String("foo".to_owned()))); + assert_eq!(from_str("\"\\\"\""), Ok(String("\"".to_owned()))); + assert_eq!(from_str("\"\\b\""), Ok(String("\x08".to_owned()))); + assert_eq!(from_str("\"\\n\""), Ok(String("\n".to_owned()))); + assert_eq!(from_str("\"\\r\""), Ok(String("\r".to_owned()))); + assert_eq!(from_str("\"\\t\""), Ok(String("\t".to_owned()))); + assert_eq!(from_str(" \"foo\" "), Ok(String("foo".to_owned()))); + assert_eq!(from_str("\"\\u12ab\""), Ok(String("\u{12ab}".to_owned()))); + assert_eq!(from_str("\"\\uAB12\""), Ok(String("\u{AB12}".to_owned()))); } #[test] @@ -3096,7 +3096,7 @@ mod tests { assert_eq!(t, (1, 2, 3)); let t: (usize, string::String) = super::decode("[1, \"two\"]").unwrap(); - assert_eq!(t, (1, "two".to_string())); + assert_eq!(t, (1, "two".to_owned())); } #[test] @@ -3126,22 +3126,22 @@ mod tests { assert_eq!(from_str("{}").unwrap(), mk_object(&[])); assert_eq!(from_str("{\"a\": 3}").unwrap(), - mk_object(&[("a".to_string(), U64(3))])); + mk_object(&[("a".to_owned(), U64(3))])); assert_eq!(from_str( "{ \"a\": null, \"b\" : true }").unwrap(), mk_object(&[ - ("a".to_string(), Null), - ("b".to_string(), Boolean(true))])); + ("a".to_owned(), Null), + ("b".to_owned(), Boolean(true))])); assert_eq!(from_str("\n{ \"a\": null, \"b\" : true }\n").unwrap(), mk_object(&[ - ("a".to_string(), Null), - ("b".to_string(), Boolean(true))])); + ("a".to_owned(), Null), + ("b".to_owned(), Boolean(true))])); assert_eq!(from_str( "{\"a\" : 1.0 ,\"b\": [ true ]}").unwrap(), mk_object(&[ - ("a".to_string(), F64(1.0)), - ("b".to_string(), Array(vec![Boolean(true)])) + ("a".to_owned(), F64(1.0)), + ("b".to_owned(), Array(vec![Boolean(true)])) ])); assert_eq!(from_str( "{\ @@ -3153,12 +3153,12 @@ mod tests { ]\ }").unwrap(), mk_object(&[ - ("a".to_string(), F64(1.0)), - ("b".to_string(), Array(vec![ + ("a".to_owned(), F64(1.0)), + ("b".to_owned(), Array(vec![ Boolean(true), - String("foo\nbar".to_string()), + String("foo\nbar".to_owned()), mk_object(&[ - ("c".to_string(), mk_object(&[("d".to_string(), Null)])) + ("c".to_owned(), mk_object(&[("d".to_owned(), Null)])) ]) ])) ])); @@ -3177,7 +3177,7 @@ mod tests { v, Outer { inner: vec![ - Inner { a: (), b: 2, c: vec!["abc".to_string(), "xyz".to_string()] } + Inner { a: (), b: 2, c: vec!["abc".to_owned(), "xyz".to_owned()] } ] } ); @@ -3203,7 +3203,7 @@ mod tests { assert_eq!(value, None); let value: Option = super::decode("\"jodhpurs\"").unwrap(); - assert_eq!(value, Some("jodhpurs".to_string())); + assert_eq!(value, Some("jodhpurs".to_owned())); } #[test] @@ -3213,7 +3213,7 @@ mod tests { let s = "{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}"; let value: Animal = super::decode(s).unwrap(); - assert_eq!(value, Frog("Henry".to_string(), 349)); + assert_eq!(value, Frog("Henry".to_owned(), 349)); } #[test] @@ -3222,8 +3222,8 @@ mod tests { \"fields\":[\"Henry\", 349]}}"; let mut map: BTreeMap = super::decode(s).unwrap(); - assert_eq!(map.remove(&"a".to_string()), Some(Dog)); - assert_eq!(map.remove(&"b".to_string()), Some(Frog("Henry".to_string(), 349))); + assert_eq!(map.remove(&"a".to_owned()), Some(Dog)); + assert_eq!(map.remove(&"b".to_owned()), Some(Frog("Henry".to_owned(), 349))); } #[test] @@ -3262,30 +3262,30 @@ mod tests { } #[test] fn test_decode_errors_struct() { - check_err::("[]", ExpectedError("Object".to_string(), "[]".to_string())); + check_err::("[]", ExpectedError("Object".to_owned(), "[]".to_owned())); check_err::("{\"x\": true, \"y\": true, \"z\": \"\", \"w\": []}", - ExpectedError("Number".to_string(), "true".to_string())); + ExpectedError("Number".to_owned(), "true".to_owned())); check_err::("{\"x\": 1, \"y\": [], \"z\": \"\", \"w\": []}", - ExpectedError("Boolean".to_string(), "[]".to_string())); + ExpectedError("Boolean".to_owned(), "[]".to_owned())); check_err::("{\"x\": 1, \"y\": true, \"z\": {}, \"w\": []}", - ExpectedError("String".to_string(), "{}".to_string())); + ExpectedError("String".to_owned(), "{}".to_owned())); check_err::("{\"x\": 1, \"y\": true, \"z\": \"\", \"w\": null}", - ExpectedError("Array".to_string(), "null".to_string())); + ExpectedError("Array".to_owned(), "null".to_owned())); check_err::("{\"x\": 1, \"y\": true, \"z\": \"\"}", - MissingFieldError("w".to_string())); + MissingFieldError("w".to_owned())); } #[test] fn test_decode_errors_enum() { check_err::("{}", - MissingFieldError("variant".to_string())); + MissingFieldError("variant".to_owned())); check_err::("{\"variant\": 1}", - ExpectedError("String".to_string(), "1".to_string())); + ExpectedError("String".to_owned(), "1".to_owned())); check_err::("{\"variant\": \"A\"}", - MissingFieldError("fields".to_string())); + MissingFieldError("fields".to_owned())); check_err::("{\"variant\": \"A\", \"fields\": null}", - ExpectedError("Array".to_string(), "null".to_string())); + ExpectedError("Array".to_owned(), "null".to_owned())); check_err::("{\"variant\": \"C\", \"fields\": []}", - UnknownVariantError("C".to_string())); + UnknownVariantError("C".to_owned())); } #[test] @@ -3490,15 +3490,15 @@ mod tests { let mut tree = BTreeMap::new(); - tree.insert("hello".to_string(), String("guten tag".to_string())); - tree.insert("goodbye".to_string(), String("sayonara".to_string())); + tree.insert("hello".to_owned(), String("guten tag".to_owned())); + tree.insert("goodbye".to_owned(), String("sayonara".to_owned())); let json = Array( // The following layout below should look a lot like // the pretty-printed JSON (indent * x) vec! ( // 0x - String("greetings".to_string()), // 1x + String("greetings".to_owned()), // 1x Object(tree), // 1x + 2x + 2x + 1x ) // 0x // End JSON array (7 lines) @@ -3577,7 +3577,7 @@ mod tests { }; let mut decoder = Decoder::new(json_obj); let result: Result, DecoderError> = Decodable::decode(&mut decoder); - assert_eq!(result, Err(ExpectedError("Number".to_string(), "a".to_string()))); + assert_eq!(result, Err(ExpectedError("Number".to_owned(), "a".to_owned()))); } fn assert_stream_equal(src: &str, @@ -3604,7 +3604,7 @@ mod tests { r#"{ "foo":"bar", "array" : [0, 1, 2, 3, 4, 5], "idents":[null,true,false]}"#, vec![ (ObjectStart, vec![]), - (StringValue("bar".to_string()), vec![StackElement::Key("foo")]), + (StringValue("bar".to_owned()), vec![StackElement::Key("foo")]), (ArrayStart, vec![StackElement::Key("array")]), (U64Value(0), vec![StackElement::Key("array"), StackElement::Index(0)]), (U64Value(1), vec![StackElement::Key("array"), StackElement::Index(1)]), @@ -3699,7 +3699,7 @@ mod tests { (ArrayStart, vec![StackElement::Key("b")]), (BooleanValue(true), vec![StackElement::Key("b"), StackElement::Index(0)]), - (StringValue("foo\nbar".to_string()), vec![StackElement::Key("b"), + (StringValue("foo\nbar".to_owned()), vec![StackElement::Key("b"), StackElement::Index(1)]), (ObjectStart, vec![StackElement::Key("b"), StackElement::Index(2)]), @@ -3842,7 +3842,7 @@ mod tests { assert!(stack.last_is_index()); assert!(stack.get(0) == StackElement::Index(1)); - stack.push_key("foo".to_string()); + stack.push_key("foo".to_owned()); assert!(stack.len() == 2); assert!(stack.is_equal_to(&[StackElement::Index(1), StackElement::Key("foo")])); @@ -3854,7 +3854,7 @@ mod tests { assert!(stack.get(0) == StackElement::Index(1)); assert!(stack.get(1) == StackElement::Key("foo")); - stack.push_key("bar".to_string()); + stack.push_key("bar".to_owned()); assert!(stack.len() == 3); assert!(stack.is_equal_to(&[StackElement::Index(1), @@ -3897,8 +3897,8 @@ mod tests { let array3 = Array(vec!(U64(1), U64(2), U64(3))); let object = { let mut tree_map = BTreeMap::new(); - tree_map.insert("a".to_string(), U64(1)); - tree_map.insert("b".to_string(), U64(2)); + tree_map.insert("a".to_owned(), U64(1)); + tree_map.insert("b".to_owned(), U64(2)); Object(tree_map) }; @@ -3921,8 +3921,8 @@ mod tests { assert_eq!(f64::NAN.to_json(), Null); assert_eq!(true.to_json(), Boolean(true)); assert_eq!(false.to_json(), Boolean(false)); - assert_eq!("abc".to_json(), String("abc".to_string())); - assert_eq!("abc".to_string().to_json(), String("abc".to_string())); + assert_eq!("abc".to_json(), String("abc".to_owned())); + assert_eq!("abc".to_owned().to_json(), String("abc".to_owned())); assert_eq!((1_usize, 2_usize).to_json(), array2); assert_eq!((1_usize, 2_usize, 3_usize).to_json(), array3); assert_eq!([1_usize, 2_usize].to_json(), array2); @@ -3930,12 +3930,12 @@ mod tests { assert_eq!((vec![1_usize, 2_usize]).to_json(), array2); assert_eq!(vec!(1_usize, 2_usize, 3_usize).to_json(), array3); let mut tree_map = BTreeMap::new(); - tree_map.insert("a".to_string(), 1 as usize); - tree_map.insert("b".to_string(), 2); + tree_map.insert("a".to_owned(), 1 as usize); + tree_map.insert("b".to_owned(), 2); assert_eq!(tree_map.to_json(), object); let mut hash_map = HashMap::new(); - hash_map.insert("a".to_string(), 1 as usize); - hash_map.insert("b".to_string(), 2); + hash_map.insert("a".to_owned(), 1 as usize); + hash_map.insert("b".to_owned(), 2); assert_eq!(hash_map.to_json(), object); assert_eq!(Some(15).to_json(), I64(15)); assert_eq!(Some(15 as usize).to_json(), U64(15)); @@ -3994,7 +3994,7 @@ mod tests { } fn big_json() -> string::String { - let mut src = "[\n".to_string(); + let mut src = "[\n".to_owned(); for _ in 0..500 { src.push_str(r#"{ "a": true, "b": null, "c":3.1415, "d": "Hello world", "e": \ [1,2,3]},"#); diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index ccc56960b02ce..aadaa00a79832 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -514,9 +514,9 @@ mod tests { #[test] fn test_into_ascii_uppercase() { - assert_eq!(("url()URL()uRl()ürl".to_string()).into_ascii_uppercase(), - "URL()URL()URL()üRL".to_string()); - assert_eq!(("hıKß".to_string()).into_ascii_uppercase(), "HıKß"); + assert_eq!(("url()URL()uRl()ürl".to_owned()).into_ascii_uppercase(), + "URL()URL()URL()üRL".to_owned()); + assert_eq!(("hıKß".to_owned()).into_ascii_uppercase(), "HıKß"); for i in 0..501 { let upper = if 'a' as u32 <= i && i <= 'z' as u32 { i + 'A' as u32 - 'a' as u32 } @@ -528,10 +528,10 @@ mod tests { #[test] fn test_into_ascii_lowercase() { - assert_eq!(("url()URL()uRl()Ürl".to_string()).into_ascii_lowercase(), + assert_eq!(("url()URL()uRl()Ürl".to_owned()).into_ascii_lowercase(), "url()url()url()Ürl"); // Dotted capital I, Kelvin sign, Sharp S. - assert_eq!(("HİKß".to_string()).into_ascii_lowercase(), "hİKß"); + assert_eq!(("HİKß".to_owned()).into_ascii_lowercase(), "hİKß"); for i in 0..501 { let lower = if 'A' as u32 <= i && i <= 'Z' as u32 { i + 'a' as u32 - 'A' as u32 } diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 44fc0f7016d8e..de7320f005f01 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -831,8 +831,8 @@ impl IntoIterator for HashSet /// ``` /// use std::collections::HashSet; /// let mut set = HashSet::new(); - /// set.insert("a".to_string()); - /// set.insert("b".to_string()); + /// set.insert("a".to_owned()); + /// set.insert("b".to_owned()); /// /// // Not possible to collect to a Vec with a regular `.iter()`. /// let v: Vec = set.into_iter().collect(); diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 379c925b5750e..94b1d8635e9f5 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -261,7 +261,7 @@ impl Error for VarError { /// /// let key = "KEY"; /// env::set_var(key, "VALUE"); -/// assert_eq!(env::var(key), Ok("VALUE".to_string())); +/// assert_eq!(env::var(key), Ok("VALUE".to_owned())); /// ``` #[stable(feature = "env", since = "1.0.0")] pub fn set_var, V: AsRef>(k: K, v: V) { @@ -289,7 +289,7 @@ pub fn set_var, V: AsRef>(k: K, v: V) { /// /// let key = "KEY"; /// env::set_var(key, "VALUE"); -/// assert_eq!(env::var(key), Ok("VALUE".to_string())); +/// assert_eq!(env::var(key), Ok("VALUE".to_owned())); /// /// env::remove_var(key); /// assert!(env::var(key).is_err()); @@ -875,7 +875,7 @@ mod tests { #[test] fn test_var_big() { - let mut s = "".to_string(); + let mut s = "".to_owned(); let mut i = 0; while i < 100 { s.push_str("aaaaaaaaaa"); diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index c355be9bc78d2..7b4f2232c6512 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -811,9 +811,9 @@ mod tests { let in_buf: &[u8] = b"a\nb\nc"; let reader = BufReader::with_capacity(2, in_buf); let mut it = reader.lines(); - assert_eq!(it.next().unwrap().unwrap(), "a".to_string()); - assert_eq!(it.next().unwrap().unwrap(), "b".to_string()); - assert_eq!(it.next().unwrap().unwrap(), "c".to_string()); + assert_eq!(it.next().unwrap().unwrap(), "a".to_owned()); + assert_eq!(it.next().unwrap().unwrap(), "b".to_owned()); + assert_eq!(it.next().unwrap().unwrap(), "c".to_owned()); assert!(it.next().is_none()); } diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 3d0dfbba0ab99..d0770717febfd 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -963,13 +963,13 @@ mod tests { fn lines() { let buf = Cursor::new(&b"12"[..]); let mut s = buf.lines(); - assert_eq!(s.next().unwrap().unwrap(), "12".to_string()); + assert_eq!(s.next().unwrap().unwrap(), "12".to_owned()); assert!(s.next().is_none()); let buf = Cursor::new(&b"12\n\n"[..]); let mut s = buf.lines(); - assert_eq!(s.next().unwrap().unwrap(), "12".to_string()); - assert_eq!(s.next().unwrap().unwrap(), "".to_string()); + assert_eq!(s.next().unwrap().unwrap(), "12".to_owned()); + assert_eq!(s.next().unwrap().unwrap(), "".to_owned()); assert!(s.next().is_none()); } diff --git a/src/libstd/process.rs b/src/libstd/process.rs index ee7cf009fc4d9..d12e39bcb316a 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -818,7 +818,7 @@ mod tests { for (ref k, ref v) in env::vars() { // don't check android RANDOM variables - if *k != "RANDOM".to_string() { + if *k != "RANDOM".to_owned() { assert!(output.contains(&format!("{}={}", *k, *v)) || diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index 0d26206f26bcf..9fc1554188bb7 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -101,7 +101,7 @@ fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize { // created. Note that this isn't necessary in general for new threads, // but we just do this to name the main thread and to give it correct // info about the stack bounds. - let thread: Thread = NewThread::new(Some("
".to_string())); + let thread: Thread = NewThread::new(Some("
".to_owned())); thread_info::set(sys::thread::guard::main(), thread); // By default, some platforms will send a *signal* when a EPIPE error diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index 2d281eb4e249c..06eca02921e1f 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -163,33 +163,33 @@ mod tests { #[test] fn test_from_value() { - let mut f = Future::from_value("snail".to_string()); + let mut f = Future::from_value("snail".to_owned()); assert_eq!(f.get(), "snail"); } #[test] fn test_from_receiver() { let (tx, rx) = channel(); - tx.send("whale".to_string()).unwrap(); + tx.send("whale".to_owned()).unwrap(); let mut f = Future::from_receiver(rx); assert_eq!(f.get(), "whale"); } #[test] fn test_from_fn() { - let mut f = Future::from_fn(move|| "brail".to_string()); + let mut f = Future::from_fn(move|| "brail".to_owned()); assert_eq!(f.get(), "brail"); } #[test] fn test_interface_get() { - let mut f = Future::from_value("fail".to_string()); + let mut f = Future::from_value("fail".to_owned()); assert_eq!(f.get(), "fail"); } #[test] fn test_interface_unwrap() { - let f = Future::from_value("fail".to_string()); + let f = Future::from_value("fail".to_owned()); assert_eq!(f.into_inner(), "fail"); } @@ -201,7 +201,7 @@ mod tests { #[test] fn test_spawn() { - let mut f = Future::spawn(move|| "bale".to_string()); + let mut f = Future::spawn(move|| "bale".to_owned()); assert_eq!(f.get(), "bale"); } diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index f090d3e77ddfc..ac26357077dac 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -121,7 +121,7 @@ //! # #![allow(unused_must_use)] //! use std::thread; //! -//! thread::Builder::new().name("child1".to_string()).spawn(move || { +//! thread::Builder::new().name("child1".to_owned()).spawn(move || { //! println!("Hello, world!"); //! }); //! ``` @@ -781,8 +781,8 @@ mod tests { #[test] fn test_named_thread() { - Builder::new().name("ada lovelace".to_string()).scoped(move|| { - assert!(thread::current().name().unwrap() == "ada lovelace".to_string()); + Builder::new().name("ada lovelace".to_owned()).scoped(move|| { + assert!(thread::current().name().unwrap() == "ada lovelace".to_owned()); }).unwrap().join(); } @@ -798,7 +798,7 @@ mod tests { #[test] fn test_join_success() { assert!(thread::scoped(move|| -> String { - "Success!".to_string() + "Success!".to_owned() }).join() == "Success!"); } @@ -815,7 +815,7 @@ mod tests { #[test] fn test_scoped_success() { let res = thread::scoped(move|| -> String { - "Success!".to_string() + "Success!".to_owned() }).join(); assert!(res == "Success!"); } @@ -945,12 +945,12 @@ mod tests { #[test] fn test_try_panic_message_owned_str() { match thread::spawn(move|| { - panic!("owned string".to_string()); + panic!("owned string".to_owned()); }).join() { Err(e) => { type T = String; assert!(e.is::()); - assert_eq!(*e.downcast::().unwrap(), "owned string".to_string()); + assert_eq!(*e.downcast::().unwrap(), "owned string".to_owned()); } Ok(()) => panic!() } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index bb8096f277069..c2d7a25f5cb7e 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -177,8 +177,8 @@ pub fn uint_ty_max(t: UintTy) -> u64 { pub fn float_ty_to_string(t: FloatTy) -> String { match t { - TyF32 => "f32".to_string(), - TyF64 => "f64".to_string(), + TyF32 => "f32".to_owned(), + TyF64 => "f64".to_owned(), } } diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index b2a366ec5beb6..9c71142b89378 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -692,7 +692,7 @@ impl CodeMap { pub fn span_to_string(&self, sp: Span) -> String { if self.files.borrow().is_empty() && sp == DUMMY_SP { - return "no-location".to_string(); + return "no-location".to_owned(); } let lo = self.lookup_char_pos_adj(sp.lo); @@ -1019,8 +1019,8 @@ mod tests { #[test] fn t1 () { let cm = CodeMap::new(); - let fm = cm.new_filemap("blork.rs".to_string(), - "first line.\nsecond line".to_string()); + let fm = cm.new_filemap("blork.rs".to_owned(), + "first line.\nsecond line".to_owned()); fm.next_line(BytePos(0)); assert_eq!(fm.get_line(0), Some("first line.")); // TESTING BROKEN BEHAVIOR: @@ -1032,8 +1032,8 @@ mod tests { #[should_panic] fn t2 () { let cm = CodeMap::new(); - let fm = cm.new_filemap("blork.rs".to_string(), - "first line.\nsecond line".to_string()); + let fm = cm.new_filemap("blork.rs".to_owned(), + "first line.\nsecond line".to_owned()); // TESTING *REALLY* BROKEN BEHAVIOR: fm.next_line(BytePos(0)); fm.next_line(BytePos(10)); @@ -1042,12 +1042,12 @@ mod tests { fn init_code_map() -> CodeMap { let cm = CodeMap::new(); - let fm1 = cm.new_filemap("blork.rs".to_string(), - "first line.\nsecond line".to_string()); - let fm2 = cm.new_filemap("empty.rs".to_string(), - "".to_string()); - let fm3 = cm.new_filemap("blork2.rs".to_string(), - "first line.\nsecond line".to_string()); + let fm1 = cm.new_filemap("blork.rs".to_owned(), + "first line.\nsecond line".to_owned()); + let fm2 = cm.new_filemap("empty.rs".to_owned(), + "".to_owned()); + let fm3 = cm.new_filemap("blork2.rs".to_owned(), + "first line.\nsecond line".to_owned()); fm1.next_line(BytePos(0)); fm1.next_line(BytePos(12)); @@ -1104,10 +1104,10 @@ mod tests { let cm = CodeMap::new(); // € is a three byte utf8 char. let fm1 = - cm.new_filemap("blork.rs".to_string(), - "fir€st €€€€ line.\nsecond line".to_string()); - let fm2 = cm.new_filemap("blork2.rs".to_string(), - "first line€€.\n€ second line".to_string()); + cm.new_filemap("blork.rs".to_owned(), + "fir€st €€€€ line.\nsecond line".to_owned()); + let fm2 = cm.new_filemap("blork2.rs".to_owned(), + "first line€€.\n€ second line".to_owned()); fm1.next_line(BytePos(0)); fm1.next_line(BytePos(22)); @@ -1210,7 +1210,7 @@ mod tests { let span = Span {lo: BytePos(12), hi: BytePos(23), expn_id: NO_EXPANSION}; let snippet = cm.span_to_snippet(span); - assert_eq!(snippet, Ok("second line".to_string())); + assert_eq!(snippet, Ok("second line".to_owned())); } #[test] diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 718bc1773fe59..96eb892194a02 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -227,7 +227,7 @@ impl Handler { let s; match self.err_count.get() { 0 => return, - 1 => s = "aborting due to previous error".to_string(), + 1 => s = "aborting due to previous error".to_owned(), _ => { s = format!("aborting due to {} previous errors", self.err_count.get()); @@ -471,7 +471,7 @@ fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan, // We cannot check equality directly with COMMAND_LINE_SP // since PartialEq is manually implemented to ignore the ExpnId let ss = if sp.expn_id == COMMAND_LINE_EXPN { - "".to_string() + "".to_owned() } else if let EndSpan(_) = rsp { let span_end = Span { lo: sp.hi, hi: sp.hi, expn_id: sp.expn_id}; cm.span_to_string(span_end) diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 54b09d863a33a..3ee368f632eec 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -129,7 +129,7 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt, } }); let sym = Ident::new(token::gensym(&( - "__register_diagnostic_".to_string() + &token::get_ident(*code) + "__register_diagnostic_".to_owned() + &token::get_ident(*code) ))); MacEager::items(SmallVector::many(vec![ ecx.item_mod( diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index 6915969032810..8b60012f12314 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -211,7 +211,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) let expn_id = cx.codemap().record_expansion(codemap::ExpnInfo { call_site: sp, callee: codemap::NameAndSpan { - name: "asm".to_string(), + name: "asm".to_owned(), format: codemap::MacroBang, span: None, allow_internal_unstable: false, diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index eab6c3ae7251a..3eca438d538ed 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -1075,7 +1075,7 @@ impl<'a> MethodDef<'a> { let self_arg_names = self_args.iter().enumerate() .map(|(arg_count, _self_arg)| { if arg_count == 0 { - "__self".to_string() + "__self".to_owned() } else { format!("__arg_{}", arg_count) } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index aa74c27dc616a..04e4110fe7d6b 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1678,17 +1678,17 @@ mod tests { // *kind* of failure occurs. fn test_ecfg() -> ExpansionConfig<'static> { - ExpansionConfig::default("test".to_string()) + ExpansionConfig::default("test".to_owned()) } // make sure that macros can't escape fns #[should_panic] #[test] fn macros_cant_escape_fns_test () { let src = "fn bogus() {macro_rules! z (() => (3+4));}\ - fn inty() -> i32 { z!() }".to_string(); + fn inty() -> i32 { z!() }".to_owned(); let sess = parse::ParseSess::new(); let crate_ast = parse::parse_crate_from_source_str( - "".to_string(), + "".to_owned(), src, Vec::new(), &sess); // should fail: @@ -1699,10 +1699,10 @@ mod tests { #[should_panic] #[test] fn macros_cant_escape_mods_test () { let src = "mod foo {macro_rules! z (() => (3+4));}\ - fn inty() -> i32 { z!() }".to_string(); + fn inty() -> i32 { z!() }".to_owned(); let sess = parse::ParseSess::new(); let crate_ast = parse::parse_crate_from_source_str( - "".to_string(), + "".to_owned(), src, Vec::new(), &sess); expand_crate(&sess,test_ecfg(),vec!(),vec!(),crate_ast); @@ -1711,10 +1711,10 @@ mod tests { // macro_use modules should allow macros to escape #[test] fn macros_can_escape_flattened_mods_test () { let src = "#[macro_use] mod foo {macro_rules! z (() => (3+4));}\ - fn inty() -> i32 { z!() }".to_string(); + fn inty() -> i32 { z!() }".to_owned(); let sess = parse::ParseSess::new(); let crate_ast = parse::parse_crate_from_source_str( - "".to_string(), + "".to_owned(), src, Vec::new(), &sess); expand_crate(&sess, test_ecfg(), vec!(), vec!(), crate_ast); @@ -1736,14 +1736,14 @@ mod tests { #[test] fn macro_tokens_should_match(){ expand_crate_str( - "macro_rules! m((a)=>(13)) ;fn main(){m!(a);}".to_string()); + "macro_rules! m((a)=>(13)) ;fn main(){m!(a);}".to_owned()); } // should be able to use a bound identifier as a literal in a macro definition: #[test] fn self_macro_parsing(){ expand_crate_str( "macro_rules! foo ((zz) => (287;)); - fn f(zz: i32) {foo!(zz);}".to_string() + fn f(zz: i32) {foo!(zz);}".to_owned() ); } @@ -1919,7 +1919,7 @@ mod tests { "macro_rules! my_method (() => (fn thirteen(&self) -> i32 {13})); struct A; impl A{ my_method!(); } - fn f(){A.thirteen;}".to_string()); + fn f(){A.thirteen;}".to_owned()); } // another nested macro @@ -2014,7 +2014,7 @@ mod tests { let crate_str = "macro_rules! fmt_wrap(($b:expr)=>($b.to_string())); macro_rules! foo_module (() => (mod generated { fn a() { let xx = 147; fmt_wrap!(xx);}})); foo_module!(); -".to_string(); +".to_owned(); let cr = expand_crate_str(crate_str); // find the xx binding let bindings = crate_bindings(&cr); @@ -2055,7 +2055,7 @@ foo_module!(); #[test] fn pat_idents(){ let pat = string_to_pat( - "(a,Foo{x:c @ (b,9),y:Bar(4,d)})".to_string()); + "(a,Foo{x:c @ (b,9),y:Bar(4,d)})".to_owned()); let idents = pattern_bindings(&*pat); assert_eq!(idents, strs_to_idents(vec!("a","c","b","d"))); } @@ -2066,7 +2066,7 @@ foo_module!(); #[test] fn crate_bindings_test(){ let the_crate = string_to_crate("fn main (a: i32) -> i32 {|b| { - match 34 {None => 3, Some(i) | i => j, Foo{k:z,l:y} => \"banana\"}} }".to_string()); + match 34 {None => 3, Some(i) | i => j, Foo{k:z,l:y} => \"banana\"}} }".to_owned()); let idents = crate_bindings(&the_crate); assert_eq!(idents, strs_to_idents(vec!("a","b","None","i","i","z","y"))); } @@ -2074,7 +2074,7 @@ foo_module!(); // test the IdentRenamer directly #[test] fn ident_renamer_test () { - let the_crate = string_to_crate("fn f(x: i32){let x = x; x}".to_string()); + let the_crate = string_to_crate("fn f(x: i32){let x = x; x}".to_owned()); let f_ident = token::str_to_ident("f"); let x_ident = token::str_to_ident("x"); let int_ident = token::str_to_ident("i32"); @@ -2089,7 +2089,7 @@ foo_module!(); // test the PatIdentRenamer; only PatIdents get renamed #[test] fn pat_ident_renamer_test () { - let the_crate = string_to_crate("fn f(x: i32){let x = x; x}".to_string()); + let the_crate = string_to_crate("fn f(x: i32){let x = x; x}".to_owned()); let f_ident = token::str_to_ident("f"); let x_ident = token::str_to_ident("x"); let int_ident = token::str_to_ident("i32"); diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 86e72d4ef03de..0cfb9c18bec3d 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -210,8 +210,8 @@ impl<'a, 'b> Context<'a, 'b> { fn describe_num_args(&self) -> String { match self.args.len() { - 0 => "no arguments given".to_string(), - 1 => "there is 1 argument".to_string(), + 0 => "no arguments given".to_owned(), + 1 => "there is 1 argument".to_owned(), x => format!("there are {} arguments", x), } } diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index e0753b2f6f6ee..94bc97b9a412c 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -285,28 +285,28 @@ pub mod rt { fn parse_item(&self, s: String) -> P { parse::parse_item_from_source_str( - "".to_string(), + "".to_owned(), s, self.cfg(), self.parse_sess()).expect("parse error") } fn parse_stmt(&self, s: String) -> P { - parse::parse_stmt_from_source_str("".to_string(), + parse::parse_stmt_from_source_str("".to_owned(), s, self.cfg(), self.parse_sess()).expect("parse error") } fn parse_expr(&self, s: String) -> P { - parse::parse_expr_from_source_str("".to_string(), + parse::parse_expr_from_source_str("".to_owned(), s, self.cfg(), self.parse_sess()) } fn parse_tts(&self, s: String) -> Vec { - parse::parse_tts_from_source_str("".to_string(), + parse::parse_tts_from_source_str("".to_owned(), s, self.cfg(), self.parse_sess()) diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 08bb4ca106486..92da72c665212 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -187,7 +187,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) // Add this input file to the code map to make it available as // dependency information, but don't enter it's contents let filename = format!("{}", file.display()); - cx.codemap().new_filemap(filename, "".to_string()); + cx.codemap().new_filemap(filename, "".to_owned()); base::MacEager::expr(cx.expr_lit(sp, ast::LitBinary(Rc::new(bytes)))) } diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 5521c68e75c69..7fa3eabe17ee6 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -418,7 +418,7 @@ pub fn parse(sess: &ParseSess, } } TtToken(sp, SubstNt(..)) => { - return Error(sp, "Cannot transcribe in macro LHS".to_string()) + return Error(sp, "Cannot transcribe in macro LHS".to_owned()) } seq @ TtDelimited(..) | seq @ TtToken(_, DocComment(..)) => { let lower_elts = mem::replace(&mut ei.top_elts, Tt(seq)); @@ -450,9 +450,9 @@ pub fn parse(sess: &ParseSess, } return Success(nameize(sess, ms, &v[..])); } else if eof_eis.len() > 1 { - return Error(sp, "ambiguity: multiple successful parses".to_string()); + return Error(sp, "ambiguity: multiple successful parses".to_owned()); } else { - return Failure(sp, "unexpected end of macro invocation".to_string()); + return Failure(sp, "unexpected end of macro invocation".to_owned()); } } else { if (!bb_eis.is_empty() && !next_eis.is_empty()) diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 03d4e21a941bf..a2d4890f33213 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -160,7 +160,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt, // Which arm's failure should we report? (the one furthest along) let mut best_fail_spot = DUMMY_SP; - let mut best_fail_msg = "internal error: ran no matchers".to_string(); + let mut best_fail_msg = "internal error: ran no matchers".to_owned(); for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers match **lhs { diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 7806a27c53e1c..64514cff1db32 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -1412,13 +1412,13 @@ mod tests { #[test] fn ident_transformation () { let mut zz_fold = ToZzIdentFolder; let ast = string_to_crate( - "#[a] mod b {fn c (d : e, f : g) {h!(i,j,k);l;m}}".to_string()); + "#[a] mod b {fn c (d : e, f : g) {h!(i,j,k);l;m}}".to_owned()); let folded_crate = zz_fold.fold_crate(ast); assert_pred!( matches_codepattern, "matches_codepattern", pprust::to_string(|s| fake_print_crate(s, &folded_crate)), - "#[a]mod zz{fn zz(zz:zz,zz:zz){zz!(zz,zz,zz);zz;zz}}".to_string()); + "#[a]mod zz{fn zz(zz:zz,zz:zz){zz!(zz,zz,zz);zz;zz}}".to_owned()); } // even inside macro defs.... @@ -1426,12 +1426,12 @@ mod tests { let mut zz_fold = ToZzIdentFolder; let ast = string_to_crate( "macro_rules! a {(b $c:expr $(d $e:token)f+ => \ - (g $(d $d $e)+))} ".to_string()); + (g $(d $d $e)+))} ".to_owned()); let folded_crate = zz_fold.fold_crate(ast); assert_pred!( matches_codepattern, "matches_codepattern", pprust::to_string(|s| fake_print_crate(s, &folded_crate)), - "zz!zz((zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+)));".to_string()); + "zz!zz((zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+)));".to_owned()); } } diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs index 1577b50ad760c..ee83be4c1ca09 100644 --- a/src/libsyntax/parse/lexer/comments.rs +++ b/src/libsyntax/parse/lexer/comments.rs @@ -228,7 +228,7 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut Vec , if col < len { (&s[col..len]).to_string() } else { - "".to_string() + "".to_owned() } } None => s, diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 32b15066b5528..c98ed95f35da3 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1071,7 +1071,7 @@ impl<'a> StringReader<'a> { // character before position `start` is an // ascii single quote. start - BytePos(1), last_bpos, - "unterminated character constant".to_string()); + "unterminated character constant".to_owned()); } let id = if valid { self.name_from(start) } else { token::intern("0") }; self.bump(); // advance curr past token @@ -1262,7 +1262,7 @@ impl<'a> StringReader<'a> { let last_pos = self.last_pos; self.fatal_span_verbose( start - BytePos(2), last_pos, - "unterminated byte constant".to_string()); + "unterminated byte constant".to_owned()); } let id = if valid { self.name_from(start) } else { token::intern("?") }; @@ -1419,7 +1419,7 @@ mod tests { // open a string reader for the given string fn setup<'a>(span_handler: &'a diagnostic::SpanHandler, teststr: String) -> StringReader<'a> { - let fm = span_handler.cm.new_filemap("zebra.rs".to_string(), teststr); + let fm = span_handler.cm.new_filemap("zebra.rs".to_owned(), teststr); StringReader::new(span_handler, fm) } @@ -1427,7 +1427,7 @@ mod tests { let span_handler = mk_sh(); let mut string_reader = setup(&span_handler, "/* my source file */ \ - fn main() { println!(\"zebra\"); }\n".to_string()); + fn main() { println!(\"zebra\"); }\n".to_owned()); let id = str_to_ident("fn"); assert_eq!(string_reader.next_token().tok, token::Comment); assert_eq!(string_reader.next_token().tok, token::Whitespace); @@ -1463,21 +1463,21 @@ mod tests { } #[test] fn doublecolonparsing () { - check_tokenization(setup(&mk_sh(), "a b".to_string()), + check_tokenization(setup(&mk_sh(), "a b".to_owned()), vec![mk_ident("a", token::Plain), token::Whitespace, mk_ident("b", token::Plain)]); } #[test] fn dcparsing_2 () { - check_tokenization(setup(&mk_sh(), "a::b".to_string()), + check_tokenization(setup(&mk_sh(), "a::b".to_owned()), vec![mk_ident("a",token::ModName), token::ModSep, mk_ident("b", token::Plain)]); } #[test] fn dcparsing_3 () { - check_tokenization(setup(&mk_sh(), "a ::b".to_string()), + check_tokenization(setup(&mk_sh(), "a ::b".to_owned()), vec![mk_ident("a", token::Plain), token::Whitespace, token::ModSep, @@ -1485,7 +1485,7 @@ mod tests { } #[test] fn dcparsing_4 () { - check_tokenization(setup(&mk_sh(), "a:: b".to_string()), + check_tokenization(setup(&mk_sh(), "a:: b".to_owned()), vec![mk_ident("a",token::ModName), token::ModSep, token::Whitespace, @@ -1493,28 +1493,28 @@ mod tests { } #[test] fn character_a() { - assert_eq!(setup(&mk_sh(), "'a'".to_string()).next_token().tok, + assert_eq!(setup(&mk_sh(), "'a'".to_owned()).next_token().tok, token::Literal(token::Char(token::intern("a")), None)); } #[test] fn character_space() { - assert_eq!(setup(&mk_sh(), "' '".to_string()).next_token().tok, + assert_eq!(setup(&mk_sh(), "' '".to_owned()).next_token().tok, token::Literal(token::Char(token::intern(" ")), None)); } #[test] fn character_escaped() { - assert_eq!(setup(&mk_sh(), "'\\n'".to_string()).next_token().tok, + assert_eq!(setup(&mk_sh(), "'\\n'".to_owned()).next_token().tok, token::Literal(token::Char(token::intern("\\n")), None)); } #[test] fn lifetime_name() { - assert_eq!(setup(&mk_sh(), "'abc".to_string()).next_token().tok, + assert_eq!(setup(&mk_sh(), "'abc".to_owned()).next_token().tok, token::Lifetime(token::str_to_ident("'abc"))); } #[test] fn raw_string() { assert_eq!(setup(&mk_sh(), - "r###\"\"#a\\b\x00c\"\"###".to_string()).next_token() + "r###\"\"#a\\b\x00c\"\"###".to_owned()).next_token() .tok, token::Literal(token::StrRaw(token::intern("\"#a\\b\x00c\""), 3), None)); } @@ -1542,13 +1542,13 @@ mod tests { test!("1.0", Float, "1.0"); test!("1.0e10", Float, "1.0e10"); - assert_eq!(setup(&mk_sh(), "2us".to_string()).next_token().tok, + assert_eq!(setup(&mk_sh(), "2us".to_owned()).next_token().tok, token::Literal(token::Integer(token::intern("2")), Some(token::intern("us")))); - assert_eq!(setup(&mk_sh(), "r###\"raw\"###suffix".to_string()).next_token().tok, + assert_eq!(setup(&mk_sh(), "r###\"raw\"###suffix".to_owned()).next_token().tok, token::Literal(token::StrRaw(token::intern("raw"), 3), Some(token::intern("suffix")))); - assert_eq!(setup(&mk_sh(), "br###\"raw\"###suffix".to_string()).next_token().tok, + assert_eq!(setup(&mk_sh(), "br###\"raw\"###suffix".to_owned()).next_token().tok, token::Literal(token::BinaryRaw(token::intern("raw"), 3), Some(token::intern("suffix")))); } @@ -1561,7 +1561,7 @@ mod tests { #[test] fn nested_block_comments() { let sh = mk_sh(); - let mut lexer = setup(&sh, "/* /* */ */'a'".to_string()); + let mut lexer = setup(&sh, "/* /* */ */'a'".to_owned()); match lexer.next_token().tok { token::Comment => { }, _ => panic!("expected a comment!") @@ -1571,7 +1571,7 @@ mod tests { #[test] fn crlf_comments() { let sh = mk_sh(); - let mut lexer = setup(&sh, "// test\r\n/// test\r\n".to_string()); + let mut lexer = setup(&sh, "// test\r\n/// test\r\n".to_owned()); let comment = lexer.next_token(); assert_eq!(comment.tok, token::Comment); assert_eq!(comment.sp, ::codemap::mk_sp(BytePos(0), BytePos(7))); diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index d6c28d4144792..34a4d924fbb8e 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -674,7 +674,7 @@ mod tests { } #[test] fn path_exprs_1() { - assert!(string_to_expr("a".to_string()) == + assert!(string_to_expr("a".to_owned()) == P(ast::Expr{ id: ast::DUMMY_NODE_ID, node: ast::ExprPath(None, ast::Path { @@ -692,7 +692,7 @@ mod tests { } #[test] fn path_exprs_2 () { - assert!(string_to_expr("::a::b".to_string()) == + assert!(string_to_expr("::a::b".to_owned()) == P(ast::Expr { id: ast::DUMMY_NODE_ID, node: ast::ExprPath(None, ast::Path { @@ -715,13 +715,13 @@ mod tests { #[should_panic] #[test] fn bad_path_expr_1() { - string_to_expr("::abc::def::return".to_string()); + string_to_expr("::abc::def::return".to_owned()); } // check the token-tree-ization of macros #[test] fn string_to_tts_macro () { - let tts = string_to_tts("macro_rules! zip (($a)=>($a))".to_string()); + let tts = string_to_tts("macro_rules! zip (($a)=>($a))".to_owned()); let tts: &[ast::TokenTree] = &tts[..]; match (tts.len(), tts.get(0), tts.get(1), tts.get(2), tts.get(3)) { @@ -775,7 +775,7 @@ mod tests { #[test] fn string_to_tts_1() { - let tts = string_to_tts("fn a (b : i32) { b; }".to_string()); + let tts = string_to_tts("fn a (b : i32) { b; }".to_owned()); let expected = vec![ ast::TtToken(sp(0, 2), @@ -821,7 +821,7 @@ mod tests { } #[test] fn ret_expr() { - assert!(string_to_expr("return d".to_string()) == + assert!(string_to_expr("return d".to_owned()) == P(ast::Expr{ id: ast::DUMMY_NODE_ID, node:ast::ExprRet(Some(P(ast::Expr{ @@ -843,7 +843,7 @@ mod tests { } #[test] fn parse_stmt_1 () { - assert!(string_to_stmt("b;".to_string()) == + assert!(string_to_stmt("b;".to_owned()) == P(Spanned{ node: ast::StmtExpr(P(ast::Expr { id: ast::DUMMY_NODE_ID, @@ -869,7 +869,7 @@ mod tests { #[test] fn parse_ident_pat () { let sess = ParseSess::new(); - let mut parser = string_to_parser(&sess, "b".to_string()); + let mut parser = string_to_parser(&sess, "b".to_owned()); assert!(panictry!(parser.parse_pat_nopanic()) == P(ast::Pat{ id: ast::DUMMY_NODE_ID, @@ -885,7 +885,7 @@ mod tests { // check the contents of the tt manually: #[test] fn parse_fundecl () { // this test depends on the intern order of "fn" and "i32" - assert_eq!(string_to_item("fn a (b : i32) { b; }".to_string()), + assert_eq!(string_to_item("fn a (b : i32) { b; }".to_owned()), Some( P(ast::Item{ident:str_to_ident("a"), attrs:Vec::new(), @@ -1030,8 +1030,8 @@ mod tests { #[test] fn parse_exprs () { // just make sure that they parse.... - string_to_expr("3 + 4".to_string()); - string_to_expr("a::z.froob(b,&(987+3))".to_string()); + string_to_expr("3 + 4".to_owned()); + string_to_expr("a::z.froob(b,&(987+3))".to_owned()); } #[test] fn attrs_fix_bug () { @@ -1046,26 +1046,26 @@ mod tests { fn wb() -> c_int { O_WRONLY as c_int } let mut fflags: c_int = wb(); -}".to_string()); +}".to_owned()); } #[test] fn crlf_doc_comments() { let sess = ParseSess::new(); - let name = "".to_string(); - let source = "/// doc comment\r\nfn foo() {}".to_string(); + let name = "".to_owned(); + let source = "/// doc comment\r\nfn foo() {}".to_owned(); let item = parse_item_from_source_str(name.clone(), source, Vec::new(), &sess).unwrap(); let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap(); assert_eq!(&doc[..], "/// doc comment"); - let source = "/// doc comment\r\n/// line 2\r\nfn foo() {}".to_string(); + let source = "/// doc comment\r\n/// line 2\r\nfn foo() {}".to_owned(); let item = parse_item_from_source_str(name.clone(), source, Vec::new(), &sess).unwrap(); let docs = item.attrs.iter().filter(|a| &*a.name() == "doc") .map(|a| a.value_str().unwrap().to_string()).collect::>(); - let b: &[_] = &["/// doc comment".to_string(), "/// line 2".to_string()]; + let b: &[_] = &["/// doc comment".to_owned(), "/// line 2".to_owned()]; assert_eq!(&docs[..], b); - let source = "/** doc comment\r\n * with CRLF */\r\nfn foo() {}".to_string(); + let source = "/** doc comment\r\n * with CRLF */\r\nfn foo() {}".to_owned(); let item = parse_item_from_source_str(name, source, Vec::new(), &sess).unwrap(); let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap(); assert_eq!(&doc[..], "/** doc comment\n * with CRLF */"); @@ -1074,8 +1074,8 @@ mod tests { #[test] fn ttdelim_span() { let sess = ParseSess::new(); - let expr = parse::parse_expr_from_source_str("foo".to_string(), - "foo!( fn main() { body } )".to_string(), vec![], &sess); + let expr = parse::parse_expr_from_source_str("foo".to_owned(), + "foo!( fn main() { body } )".to_owned(), vec![], &sess); let tts = match expr.node { ast::ExprMac(ref mac) => { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index dcf6667b60644..0cd2824f2da2a 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -287,7 +287,7 @@ impl TokenType { fn to_string(&self) -> String { match *self { TokenType::Token(ref t) => format!("`{}`", Parser::token_to_string(t)), - TokenType::Operator => "an operator".to_string(), + TokenType::Operator => "an operator".to_owned(), TokenType::Keyword(kw) => format!("`{}`", token::get_name(kw.to_name())), } } @@ -417,7 +417,7 @@ impl<'a> Parser<'a> { let mut i = tokens.iter(); // This might be a sign we need a connect method on Iterator. let b = i.next() - .map_or("".to_string(), |t| t.to_string()); + .map_or("".to_owned(), |t| t.to_string()); i.enumerate().fold(b, |mut b, (i, ref a)| { if tokens.len() > 2 && i == tokens.len() - 2 { b.push_str(", or "); @@ -2617,7 +2617,7 @@ impl<'a> Parser<'a> { let box_span = mk_sp(lo, box_hi); self.span_suggestion(box_span, "try using `box()` instead:", - "box()".to_string()); + "box()".to_owned()); self.abort_if_errors(); } let subexpression = try!(self.parse_prefix_expr()); diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index ed9937c53f4af..d80d72979f58c 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -114,10 +114,10 @@ impl Token { pub fn tok_str(token: &Token) -> String { match *token { Token::String(ref s, len) => format!("STR({},{})", s, len), - Token::Break(_) => "BREAK".to_string(), - Token::Begin(_) => "BEGIN".to_string(), - Token::End => "END".to_string(), - Token::Eof => "EOF".to_string() + Token::Break(_) => "BREAK".to_owned(), + Token::Begin(_) => "BEGIN".to_owned(), + Token::End => "END".to_owned(), + Token::Eof => "EOF".to_owned() } } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 8958370fda544..ca013905385bd 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -210,41 +210,41 @@ pub fn binop_to_string(op: BinOpToken) -> &'static str { pub fn token_to_string(tok: &Token) -> String { match *tok { - token::Eq => "=".to_string(), - token::Lt => "<".to_string(), - token::Le => "<=".to_string(), - token::EqEq => "==".to_string(), - token::Ne => "!=".to_string(), - token::Ge => ">=".to_string(), - token::Gt => ">".to_string(), - token::Not => "!".to_string(), - token::Tilde => "~".to_string(), - token::OrOr => "||".to_string(), - token::AndAnd => "&&".to_string(), + token::Eq => "=".to_owned(), + token::Lt => "<".to_owned(), + token::Le => "<=".to_owned(), + token::EqEq => "==".to_owned(), + token::Ne => "!=".to_owned(), + token::Ge => ">=".to_owned(), + token::Gt => ">".to_owned(), + token::Not => "!".to_owned(), + token::Tilde => "~".to_owned(), + token::OrOr => "||".to_owned(), + token::AndAnd => "&&".to_owned(), token::BinOp(op) => binop_to_string(op).to_string(), token::BinOpEq(op) => format!("{}=", binop_to_string(op)), /* Structural symbols */ - token::At => "@".to_string(), - token::Dot => ".".to_string(), - token::DotDot => "..".to_string(), - token::DotDotDot => "...".to_string(), - token::Comma => ",".to_string(), - token::Semi => ";".to_string(), - token::Colon => ":".to_string(), - token::ModSep => "::".to_string(), - token::RArrow => "->".to_string(), - token::LArrow => "<-".to_string(), - token::FatArrow => "=>".to_string(), - token::OpenDelim(token::Paren) => "(".to_string(), - token::CloseDelim(token::Paren) => ")".to_string(), - token::OpenDelim(token::Bracket) => "[".to_string(), - token::CloseDelim(token::Bracket) => "]".to_string(), - token::OpenDelim(token::Brace) => "{".to_string(), - token::CloseDelim(token::Brace) => "}".to_string(), - token::Pound => "#".to_string(), - token::Dollar => "$".to_string(), - token::Question => "?".to_string(), + token::At => "@".to_owned(), + token::Dot => ".".to_owned(), + token::DotDot => "..".to_owned(), + token::DotDotDot => "...".to_owned(), + token::Comma => ",".to_owned(), + token::Semi => ";".to_owned(), + token::Colon => ":".to_owned(), + token::ModSep => "::".to_owned(), + token::RArrow => "->".to_owned(), + token::LArrow => "<-".to_owned(), + token::FatArrow => "=>".to_owned(), + token::OpenDelim(token::Paren) => "(".to_owned(), + token::CloseDelim(token::Paren) => ")".to_owned(), + token::OpenDelim(token::Bracket) => "[".to_owned(), + token::CloseDelim(token::Bracket) => "]".to_owned(), + token::OpenDelim(token::Brace) => "{".to_owned(), + token::CloseDelim(token::Brace) => "}".to_owned(), + token::Pound => "#".to_owned(), + token::Dollar => "$".to_owned(), + token::Question => "?".to_owned(), /* Literals */ token::Literal(lit, suf) => { @@ -273,15 +273,15 @@ pub fn token_to_string(tok: &Token) -> String { /* Name components */ token::Ident(s, _) => token::get_ident(s).to_string(), token::Lifetime(s) => format!("{}", token::get_ident(s)), - token::Underscore => "_".to_string(), + token::Underscore => "_".to_owned(), /* Other */ token::DocComment(s) => s.as_str().to_string(), token::SubstNt(s, _) => format!("${}", s), token::MatchNt(s, t, _, _) => format!("${}:{}", s, t), - token::Eof => "".to_string(), - token::Whitespace => " ".to_string(), - token::Comment => "/* */".to_string(), + token::Eof => "".to_owned(), + token::Whitespace => " ".to_owned(), + token::Comment => "/* */".to_owned(), token::Shebang(s) => format!("/* shebang: {}*/", s.as_str()), token::SpecialVarNt(var) => format!("${}", var.as_str()), diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index c680d5bbbdf7a..bd015d9ae7221 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -250,7 +250,7 @@ fn generate_test_harness(sess: &ParseSess, sess: sess, span_diagnostic: sd, ext_cx: ExtCtxt::new(sess, cfg.clone(), - ExpansionConfig::default("test".to_string())), + ExpansionConfig::default("test".to_owned())), path: Vec::new(), testfns: Vec::new(), reexport_test_harness_main: reexport_test_harness_main, @@ -262,7 +262,7 @@ fn generate_test_harness(sess: &ParseSess, cx.ext_cx.bt_push(ExpnInfo { call_site: DUMMY_SP, callee: NameAndSpan { - name: "test".to_string(), + name: "test".to_owned(), format: MacroAttribute, span: None, allow_internal_unstable: false, @@ -295,7 +295,7 @@ fn ignored_span(cx: &TestCtxt, sp: Span) -> Span { let info = ExpnInfo { call_site: DUMMY_SP, callee: NameAndSpan { - name: "test".to_string(), + name: "test".to_owned(), format: MacroAttribute, span: None, allow_internal_unstable: true, diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index 6e6e2d181b9ef..9a53a5360c904 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -19,14 +19,14 @@ use str::char_at; /// Map a string to tts, using a made-up filename: pub fn string_to_tts(source_str: String) -> Vec { let ps = ParseSess::new(); - filemap_to_tts(&ps, ps.codemap().new_filemap("bogofile".to_string(), source_str)) + filemap_to_tts(&ps, ps.codemap().new_filemap("bogofile".to_owned(), source_str)) } /// Map string to parser (via tts) pub fn string_to_parser<'a>(ps: &'a ParseSess, source_str: String) -> Parser<'a> { new_parser_from_source_str(ps, Vec::new(), - "bogofile".to_string(), + "bogofile".to_owned(), source_str) } diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs index 4840cd1fddadf..c01734741f6b6 100644 --- a/src/libterm/terminfo/mod.rs +++ b/src/libterm/terminfo/mod.rs @@ -151,7 +151,7 @@ impl Terminal for TerminfoTerminal { cap = self.ti.strings.get("op"); } } - let s = cap.map_or(Err("can't find terminfo capability `sgr0`".to_string()), |op| { + let s = cap.map_or(Err("can't find terminfo capability `sgr0`".to_owned()), |op| { expand(op, &[], &mut Variables::new()) }); if s.is_ok() { diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 2b8c24741ae7c..0b2d14a238e3a 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -133,9 +133,9 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) c as u8 }) } - _ => return Err("a non-char was used with %c".to_string()) + _ => return Err("a non-char was used with %c".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, 'p' => state = PushParam, 'P' => state = SetVar, 'g' => state = GetVar, @@ -144,112 +144,112 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) 'l' => if !stack.is_empty() { match stack.pop().unwrap() { Words(s) => stack.push(Number(s.len() as isize)), - _ => return Err("a non-str was used with %l".to_string()) + _ => return Err("a non-str was used with %l".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, '+' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x + y)), - _ => return Err("non-numbers on stack with +".to_string()) + _ => return Err("non-numbers on stack with +".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, '-' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x - y)), - _ => return Err("non-numbers on stack with -".to_string()) + _ => return Err("non-numbers on stack with -".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, '*' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x * y)), - _ => return Err("non-numbers on stack with *".to_string()) + _ => return Err("non-numbers on stack with *".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, '/' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x / y)), - _ => return Err("non-numbers on stack with /".to_string()) + _ => return Err("non-numbers on stack with /".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, 'm' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x % y)), - _ => return Err("non-numbers on stack with %".to_string()) + _ => return Err("non-numbers on stack with %".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, '&' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x & y)), - _ => return Err("non-numbers on stack with &".to_string()) + _ => return Err("non-numbers on stack with &".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, '|' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x | y)), - _ => return Err("non-numbers on stack with |".to_string()) + _ => return Err("non-numbers on stack with |".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, '^' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x ^ y)), - _ => return Err("non-numbers on stack with ^".to_string()) + _ => return Err("non-numbers on stack with ^".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, '=' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(if x == y { 1 } else { 0 })), - _ => return Err("non-numbers on stack with =".to_string()) + _ => return Err("non-numbers on stack with =".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, '>' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(if x > y { 1 } else { 0 })), - _ => return Err("non-numbers on stack with >".to_string()) + _ => return Err("non-numbers on stack with >".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, '<' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(if x < y { 1 } else { 0 })), - _ => return Err("non-numbers on stack with <".to_string()) + _ => return Err("non-numbers on stack with <".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, 'A' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(0), Number(_)) => stack.push(Number(0)), (Number(_), Number(0)) => stack.push(Number(0)), (Number(_), Number(_)) => stack.push(Number(1)), - _ => return Err("non-numbers on stack with logical and".to_string()) + _ => return Err("non-numbers on stack with logical and".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, 'O' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(0), Number(0)) => stack.push(Number(0)), (Number(_), Number(_)) => stack.push(Number(1)), - _ => return Err("non-numbers on stack with logical or".to_string()) + _ => return Err("non-numbers on stack with logical or".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, '!' => if !stack.is_empty() { match stack.pop().unwrap() { Number(0) => stack.push(Number(1)), Number(_) => stack.push(Number(0)), - _ => return Err("non-number on stack with logical not".to_string()) + _ => return Err("non-number on stack with logical not".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, '~' => if !stack.is_empty() { match stack.pop().unwrap() { Number(x) => stack.push(Number(!x)), - _ => return Err("non-number on stack with %~".to_string()) + _ => return Err("non-number on stack with %~".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, 'i' => match (mparams[0].clone(), mparams[1].clone()) { (Number(x), Number(y)) => { mparams[0] = Number(x+1); mparams[1] = Number(y+1); }, - (_, _) => return Err("first two params not numbers with %i".to_string()) + (_, _) => return Err("first two params not numbers with %i".to_owned()) }, // printf-style support for %doxXs @@ -258,7 +258,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) let res = format(stack.pop().unwrap(), FormatOp::from_char(cur), flags); if res.is_err() { return res } output.push_all(&res.unwrap()) - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, ':'|'#'|' '|'.'|'0'...'9' => { let mut flags = Flags::new(); let mut fstate = FormatStateFlags; @@ -283,9 +283,9 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) Number(0) => state = SeekIfElse(0), Number(_) => (), _ => return Err("non-number on stack \ - with conditional".to_string()) + with conditional".to_owned()) } - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, 'e' => state = SeekIfEnd(0), ';' => (), @@ -298,7 +298,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) // params are 1-indexed stack.push(mparams[match cur.to_digit(10) { Some(d) => d as usize - 1, - None => return Err("bad param number".to_string()) + None => return Err("bad param number".to_owned()) }].clone()); }, SetVar => { @@ -306,14 +306,14 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) if !stack.is_empty() { let idx = (cur as u8) - b'A'; vars.sta[idx as usize] = stack.pop().unwrap(); - } else { return Err("stack is empty".to_string()) } + } else { return Err("stack is empty".to_owned()) } } else if cur >= 'a' && cur <= 'z' { if !stack.is_empty() { let idx = (cur as u8) - b'a'; vars.dyn[idx as usize] = stack.pop().unwrap(); - } else { return Err("stack is empty".to_string()) } + } else { return Err("stack is empty".to_owned()) } } else { - return Err("bad variable name in %P".to_string()); + return Err("bad variable name in %P".to_owned()); } }, GetVar => { @@ -324,7 +324,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) let idx = (cur as u8) - b'a'; stack.push(vars.dyn[idx as usize].clone()); } else { - return Err("bad variable name in %g".to_string()); + return Err("bad variable name in %g".to_owned()); } }, CharConstant => { @@ -333,7 +333,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) }, CharClose => { if cur != '\'' { - return Err("malformed character constant".to_string()); + return Err("malformed character constant".to_owned()); } }, IntConstant(i) => { @@ -346,7 +346,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) state = IntConstant(i*10 + (cur as isize - '0' as isize)); old_state = Nothing; } - _ => return Err("bad isize constant".to_string()) + _ => return Err("bad isize constant".to_owned()) } } FormatPattern(ref mut flags, ref mut fstate) => { @@ -358,7 +358,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) output.push_all(&res.unwrap()); // will cause state to go to Nothing old_state = FormatPattern(*flags, *fstate); - } else { return Err("stack is empty".to_string()) }, + } else { return Err("stack is empty".to_owned()) }, (FormatStateFlags,'#') => { flags.alternate = true; } @@ -381,7 +381,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) (FormatStateWidth,'0'...'9') => { let old = flags.width; flags.width = flags.width * 10 + (cur as usize - '0' as usize); - if flags.width < old { return Err("format width overflow".to_string()) } + if flags.width < old { return Err("format width overflow".to_owned()) } } (FormatStateWidth,'.') => { *fstate = FormatStatePrecision; @@ -390,10 +390,10 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) let old = flags.precision; flags.precision = flags.precision * 10 + (cur as usize - '0' as usize); if flags.precision < old { - return Err("format precision overflow".to_string()) + return Err("format precision overflow".to_owned()) } } - _ => return Err("invalid format specifier".to_string()) + _ => return Err("invalid format specifier".to_owned()) } } SeekIfElse(level) => { @@ -502,7 +502,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result ,String> { (FormatHex, _) => format!("{:x}", d).into_bytes(), (FormatHEX, _) => format!("{:X}", d).into_bytes(), (FormatString, _) => { - return Err("non-number on stack with %s".to_string()) + return Err("non-number on stack with %s".to_owned()) } }; let mut s: Vec = s.into_iter().collect(); @@ -618,7 +618,7 @@ mod tests { assert!(res.is_err(), "Op {} succeeded incorrectly with 0 stack entries", cap); let p = if cap == "%s" || cap == "%l" { - Words("foo".to_string()) + Words("foo".to_owned()) } else { Number(97) }; @@ -687,12 +687,12 @@ mod tests { let mut varstruct = Variables::new(); let vars = &mut varstruct; assert_eq!(expand(b"%p1%s%p2%2s%p3%2s%p4%.2s", - &[Words("foo".to_string()), - Words("foo".to_string()), - Words("f".to_string()), - Words("foo".to_string())], vars), + &[Words("foo".to_owned()), + Words("foo".to_owned()), + Words("f".to_owned()), + Words("foo".to_owned())], vars), Ok("foofoo ffo".bytes().collect::>())); - assert_eq!(expand(b"%p1%:-4.2s", &[Words("foo".to_string())], vars), + assert_eq!(expand(b"%p1%:-4.2s", &[Words("foo".to_owned())], vars), Ok("fo ".bytes().collect::>())); assert_eq!(expand(b"%p1%d%p1%.3d%p1%5d%p1%:+d", &[Number(1)], vars), diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index ef42d8c2506b3..2f5fd550fd6f6 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -199,24 +199,24 @@ pub fn parse(file: &mut Read, longnames: bool) if (bools_bytes as usize) > boolnames.len() { return Err("incompatible file: more booleans than \ - expected".to_string()); + expected".to_owned()); } if (numbers_count as usize) > numnames.len() { return Err("incompatible file: more numbers than \ - expected".to_string()); + expected".to_owned()); } if (string_offsets_count as usize) > stringnames.len() { return Err("incompatible file: more string offsets than \ - expected".to_string()); + expected".to_owned()); } // don't read NUL let bytes = try!(read_exact(file, names_bytes as usize - 1)); let names_str = match String::from_utf8(bytes) { Ok(s) => s, - Err(_) => return Err("input not utf-8".to_string()), + Err(_) => return Err("input not utf-8".to_owned()), }; let term_names: Vec = names_str.split('|') @@ -261,7 +261,7 @@ pub fn parse(file: &mut Read, longnames: bool) if string_table.len() != string_table_bytes as usize { return Err("error: hit EOF before end of string \ - table".to_string()); + table".to_owned()); } for (i, v) in string_offsets.iter().enumerate() { @@ -295,7 +295,7 @@ pub fn parse(file: &mut Read, longnames: bool) }, None => { return Err("invalid file: missing NUL in \ - string_table".to_string()); + string_table".to_owned()); } }; } @@ -332,12 +332,12 @@ fn read_exact(r: &mut R, sz: usize) -> io::Result> { /// Create a dummy TermInfo struct for msys terminals pub fn msys_terminfo() -> Box { let mut strings = HashMap::new(); - strings.insert("sgr0".to_string(), b"\x1B[0m".to_vec()); - strings.insert("bold".to_string(), b"\x1B[1m".to_vec()); - strings.insert("setaf".to_string(), b"\x1B[3%p1%dm".to_vec()); - strings.insert("setab".to_string(), b"\x1B[4%p1%dm".to_vec()); + strings.insert("sgr0".to_owned(), b"\x1B[0m".to_vec()); + strings.insert("bold".to_owned(), b"\x1B[1m".to_vec()); + strings.insert("setaf".to_owned(), b"\x1B[3%p1%dm".to_vec()); + strings.insert("setab".to_owned(), b"\x1B[4%p1%dm".to_vec()); box TermInfo { - names: vec!("cygwin".to_string()), // msys is a fork of an older cygwin version + names: vec!("cygwin".to_owned()), // msys is a fork of an older cygwin version bools: HashMap::new(), numbers: HashMap::new(), strings: strings diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 5ea843918be5f..d565874adfe2c 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -566,9 +566,9 @@ impl ConsoleTestState { None => Ok(()), Some(ref mut o) => { let s = format!("{} {}\n", match *result { - TrOk => "ok".to_string(), - TrFailed => "failed".to_string(), - TrIgnored => "ignored".to_string(), + TrOk => "ok".to_owned(), + TrFailed => "failed".to_owned(), + TrIgnored => "ignored".to_owned(), TrMetrics(ref mm) => mm.fmt_metrics(), TrBench(ref bs) => fmt_bench_samples(bs) }, test.name); @@ -1334,9 +1334,9 @@ mod tests { #[test] fn parse_ignored_flag() { - let args = vec!("progname".to_string(), - "filter".to_string(), - "--ignored".to_string()); + let args = vec!("progname".to_owned(), + "filter".to_owned(), + "--ignored".to_owned()); let opts = match parse_opts(&args) { Some(Ok(o)) => o, _ => panic!("Malformed arg in parse_ignored_flag") @@ -1384,15 +1384,15 @@ mod tests { opts.run_tests = true; let names = - vec!("sha1::test".to_string(), - "isize::test_to_str".to_string(), - "isize::test_pow".to_string(), - "test::do_not_run_ignored_tests".to_string(), - "test::ignored_tests_result_in_ignored".to_string(), - "test::first_free_arg_should_be_a_filter".to_string(), - "test::parse_ignored_flag".to_string(), - "test::filter_for_ignored_option".to_string(), - "test::sort_tests".to_string()); + vec!("sha1::test".to_owned(), + "isize::test_to_str".to_owned(), + "isize::test_pow".to_owned(), + "test::do_not_run_ignored_tests".to_owned(), + "test::ignored_tests_result_in_ignored".to_owned(), + "test::first_free_arg_should_be_a_filter".to_owned(), + "test::parse_ignored_flag".to_owned(), + "test::filter_for_ignored_option".to_owned(), + "test::sort_tests".to_owned()); let tests = { fn testfn() { } @@ -1413,15 +1413,15 @@ mod tests { let filtered = filter_tests(&opts, tests); let expected = - vec!("isize::test_pow".to_string(), - "isize::test_to_str".to_string(), - "sha1::test".to_string(), - "test::do_not_run_ignored_tests".to_string(), - "test::filter_for_ignored_option".to_string(), - "test::first_free_arg_should_be_a_filter".to_string(), - "test::ignored_tests_result_in_ignored".to_string(), - "test::parse_ignored_flag".to_string(), - "test::sort_tests".to_string()); + vec!("isize::test_pow".to_owned(), + "isize::test_to_str".to_owned(), + "sha1::test".to_owned(), + "test::do_not_run_ignored_tests".to_owned(), + "test::filter_for_ignored_option".to_owned(), + "test::first_free_arg_should_be_a_filter".to_owned(), + "test::ignored_tests_result_in_ignored".to_owned(), + "test::parse_ignored_flag".to_owned(), + "test::sort_tests".to_owned()); for (a, b) in expected.iter().zip(filtered.iter()) { assert!(*a == b.desc.name.to_string()); diff --git a/src/rustbook/book.rs b/src/rustbook/book.rs index 2d630d8fe8de7..65206bc9a0e11 100644 --- a/src/rustbook/book.rs +++ b/src/rustbook/book.rs @@ -49,7 +49,7 @@ impl<'a> Iterator for BookItems<'a> { } else { let cur = self.cur_items.get(self.cur_idx).unwrap(); - let mut section = "".to_string(); + let mut section = "".to_owned(); for &(_, idx) in &self.stack { section.push_str(&(idx + 1).to_string()[..]); section.push('.'); @@ -100,7 +100,7 @@ pub fn parse_summary(input: &mut Read, src: &Path) -> Result> // always include the introduction top_items.push(BookItem { - title: "Introduction".to_string(), + title: "Introduction".to_owned(), path: PathBuf::from("README.md"), path_to_root: PathBuf::from("."), children: vec!(), diff --git a/src/rustbook/build.rs b/src/rustbook/build.rs index 5ffb9b007d041..3fd0e93fd8ac7 100644 --- a/src/rustbook/build.rs +++ b/src/rustbook/build.rs @@ -138,14 +138,14 @@ fn render(book: &Book, tgt: &Path) -> CliResult<()> { try!(fs::create_dir_all(&out_path)); let rustdoc_args: &[String] = &[ - "".to_string(), + "".to_owned(), preprocessed_path.display().to_string(), format!("-o{}", out_path.display()), format!("--html-before-content={}", prelude.display()), format!("--html-after-content={}", postlude.display()), format!("--markdown-playground-url=http://play.rust-lang.org"), format!("--markdown-css={}", item.path_to_root.join("rust-book.css").display()), - "--markdown-no-toc".to_string(), + "--markdown-no-toc".to_owned(), ]; let output_result = rustdoc::main_args(rustdoc_args); if output_result != 0 { diff --git a/src/test/auxiliary/issue-2631-a.rs b/src/test/auxiliary/issue-2631-a.rs index 604a3e69a2176..0cbf521af37ab 100644 --- a/src/test/auxiliary/issue-2631-a.rs +++ b/src/test/auxiliary/issue-2631-a.rs @@ -19,6 +19,6 @@ pub type header_map = HashMap>>>>; // the unused ty param is necessary so this gets monomorphized pub fn request(req: &header_map) { - let data = req[&"METHOD".to_string()].clone(); + let data = req[&"METHOD".to_owned()].clone(); let _x = data.borrow().clone()[0].clone(); } diff --git a/src/test/auxiliary/reexported_static_methods.rs b/src/test/auxiliary/reexported_static_methods.rs index cc4db1a958169..92d16c6c00385 100644 --- a/src/test/auxiliary/reexported_static_methods.rs +++ b/src/test/auxiliary/reexported_static_methods.rs @@ -47,7 +47,7 @@ pub mod sub_foo { impl Bort { pub fn bort() -> String { - "bort()".to_string() + "bort()".to_owned() } } } diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index 6e85abb8e149f..ee82e1e881200 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -43,7 +43,7 @@ fn maybe_run_test(argv: &[String], name: String, test: F) where F: FnOnce() { if env::var_os("RUST_BENCH").is_some() { run_test = true } else if !argv.is_empty() { - run_test = argv.iter().any(|x| x == &"all".to_string()) || argv.iter().any(|x| x == &name) + run_test = argv.iter().any(|x| x == &"all".to_owned()) || argv.iter().any(|x| x == &name) } if !run_test { diff --git a/src/test/bench/core-uint-to-str.rs b/src/test/bench/core-uint-to-str.rs index 287958f43fb8d..e8d85e1f6345e 100644 --- a/src/test/bench/core-uint-to-str.rs +++ b/src/test/bench/core-uint-to-str.rs @@ -13,9 +13,9 @@ use std::env; fn main() { let args = env::args(); let args = if env::var_os("RUST_BENCH").is_some() { - vec!("".to_string(), "10000000".to_string()) + vec!("".to_owned(), "10000000".to_owned()) } else if args.len() <= 1 { - vec!("".to_string(), "100000".to_string()) + vec!("".to_owned(), "100000".to_owned()) } else { args.collect() }; diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index 2b7e204423e32..3dc8535def158 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -97,9 +97,9 @@ fn run(args: &[String]) { fn main() { let args = env::args(); let args = if env::var_os("RUST_BENCH").is_some() { - vec!("".to_string(), "1000000".to_string(), "10000".to_string()) + vec!("".to_owned(), "1000000".to_owned(), "10000".to_owned()) } else if args.len() <= 1 { - vec!("".to_string(), "10000".to_string(), "4".to_string()) + vec!("".to_owned(), "10000".to_owned(), "4".to_owned()) } else { args.map(|x| x.to_string()).collect() }; diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index 5a541420d2abf..dd54acbe6eb13 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -104,9 +104,9 @@ fn run(args: &[String]) { fn main() { let args = env::args(); let args = if env::var_os("RUST_BENCH").is_some() { - vec!("".to_string(), "1000000".to_string(), "8".to_string()) + vec!("".to_owned(), "1000000".to_owned(), "8".to_owned()) } else if args.len() <= 1 { - vec!("".to_string(), "10000".to_string(), "4".to_string()) + vec!("".to_owned(), "10000".to_owned(), "4".to_owned()) } else { args.map(|x| x.to_string()).collect() }; diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs index 93e3394097bc5..a8a54abe81d38 100644 --- a/src/test/bench/msgsend-ring-mutex-arcs.rs +++ b/src/test/bench/msgsend-ring-mutex-arcs.rs @@ -66,9 +66,9 @@ fn thread_ring(i: usize, count: usize, num_chan: pipe, num_port: pipe) { fn main() { let args = env::args(); let args = if env::var_os("RUST_BENCH").is_some() { - vec!("".to_string(), "100".to_string(), "10000".to_string()) + vec!("".to_owned(), "100".to_owned(), "10000".to_owned()) } else if args.len() <= 1 { - vec!("".to_string(), "10".to_string(), "100".to_string()) + vec!("".to_owned(), "10".to_owned(), "100".to_owned()) } else { args.collect() }; diff --git a/src/test/bench/shootout-ackermann.rs b/src/test/bench/shootout-ackermann.rs index d07aa8850aa83..0bb0d5e15c19e 100644 --- a/src/test/bench/shootout-ackermann.rs +++ b/src/test/bench/shootout-ackermann.rs @@ -25,9 +25,9 @@ fn ack(m: i64, n: i64) -> i64 { fn main() { let mut args = env::args(); let args = if env::var_os("RUST_BENCH").is_some() { - vec!("".to_string(), "12".to_string()) + vec!("".to_owned(), "12".to_owned()) } else if args.len() <= 1 { - vec!("".to_string(), "8".to_string()) + vec!("".to_owned(), "8".to_owned()) } else { args.collect() }; diff --git a/src/test/bench/shootout-fibo.rs b/src/test/bench/shootout-fibo.rs index 6f9c775609af5..fc2db30165dc9 100644 --- a/src/test/bench/shootout-fibo.rs +++ b/src/test/bench/shootout-fibo.rs @@ -21,9 +21,9 @@ fn fib(n: i64) -> i64 { fn main() { let args = env::args(); let args = if env::var_os("RUST_BENCH").is_some() { - vec!("".to_string(), "40".to_string()) + vec!("".to_owned(), "40".to_owned()) } else if args.len() <= 1 { - vec!("".to_string(), "30".to_string()) + vec!("".to_owned(), "30".to_owned()) } else { args.collect() }; diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 365a86464e2d3..a9b66e9b4fb0d 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -130,13 +130,13 @@ fn make_sequence_processor(sz: usize, let buffer = match sz { 1 => { sort_and_fmt(&freqs, total) } 2 => { sort_and_fmt(&freqs, total) } - 3 => { format!("{}\t{}", find(&freqs, "GGT".to_string()), "GGT") } - 4 => { format!("{}\t{}", find(&freqs, "GGTA".to_string()), "GGTA") } - 6 => { format!("{}\t{}", find(&freqs, "GGTATT".to_string()), "GGTATT") } - 12 => { format!("{}\t{}", find(&freqs, "GGTATTTTAATT".to_string()), "GGTATTTTAATT") } - 18 => { format!("{}\t{}", find(&freqs, "GGTATTTTAATTTATAGT".to_string()), + 3 => { format!("{}\t{}", find(&freqs, "GGT".to_owned()), "GGT") } + 4 => { format!("{}\t{}", find(&freqs, "GGTA".to_owned()), "GGTA") } + 6 => { format!("{}\t{}", find(&freqs, "GGTATT".to_owned()), "GGTATT") } + 12 => { format!("{}\t{}", find(&freqs, "GGTATTTTAATT".to_owned()), "GGTATTTTAATT") } + 18 => { format!("{}\t{}", find(&freqs, "GGTATTTTAATTTATAGT".to_owned()), "GGTATTTTAATTTATAGT") } - _ => { "".to_string() } + _ => { "".to_owned() } }; to_parent.send(buffer).unwrap(); diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 2d5aae30ae8a9..8a09ff2aa9af8 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -92,9 +92,9 @@ fn stress(num_tasks: isize) { fn main() { let args = env::args(); let args = if env::var_os("RUST_BENCH").is_some() { - vec!("".to_string(), "20".to_string()) + vec!("".to_owned(), "20".to_owned()) } else if args.len() <= 1 { - vec!("".to_string(), "8".to_string()) + vec!("".to_owned(), "8".to_owned()) } else { args.map(|x| x.to_string()).collect() }; diff --git a/src/test/bench/std-smallintmap.rs b/src/test/bench/std-smallintmap.rs index d7e556a124fe1..7742ba1b3e4a4 100644 --- a/src/test/bench/std-smallintmap.rs +++ b/src/test/bench/std-smallintmap.rs @@ -31,9 +31,9 @@ fn check_sequential(min: usize, max: usize, map: &VecMap) { fn main() { let args = env::args(); let args = if env::var_os("RUST_BENCH").is_some() { - vec!("".to_string(), "100000".to_string(), "100".to_string()) + vec!("".to_owned(), "100000".to_owned(), "100".to_owned()) } else if args.len() <= 1 { - vec!("".to_string(), "10000".to_string(), "50".to_string()) + vec!("".to_owned(), "10000".to_owned(), "50".to_owned()) } else { args.collect() }; diff --git a/src/test/bench/task-perf-jargon-metal-smoke.rs b/src/test/bench/task-perf-jargon-metal-smoke.rs index 6e3db3d01960e..c787599331574 100644 --- a/src/test/bench/task-perf-jargon-metal-smoke.rs +++ b/src/test/bench/task-perf-jargon-metal-smoke.rs @@ -40,9 +40,9 @@ fn child_generation(gens_left: usize, tx: Sender<()>) { fn main() { let args = env::args(); let args = if env::var_os("RUST_BENCH").is_some() { - vec!("".to_string(), "100000".to_string()) + vec!("".to_owned(), "100000".to_owned()) } else if args.len() <= 1 { - vec!("".to_string(), "100".to_string()) + vec!("".to_owned(), "100".to_owned()) } else { args.collect() }; diff --git a/src/test/bench/task-perf-spawnalot.rs b/src/test/bench/task-perf-spawnalot.rs index b5aa8e8d791d2..c3ea383b5f809 100644 --- a/src/test/bench/task-perf-spawnalot.rs +++ b/src/test/bench/task-perf-spawnalot.rs @@ -24,9 +24,9 @@ fn g() { } fn main() { let args = env::args(); let args = if env::var_os("RUST_BENCH").is_some() { - vec!("".to_string(), "400".to_string()) + vec!("".to_owned(), "400".to_owned()) } else if args.len() <= 1 { - vec!("".to_string(), "10".to_string()) + vec!("".to_owned(), "10".to_owned()) } else { args.collect() }; diff --git a/src/test/compile-fail-fulldeps/qquote.rs b/src/test/compile-fail-fulldeps/qquote.rs index c83a154056ba2..082f56ead3442 100644 --- a/src/test/compile-fail-fulldeps/qquote.rs +++ b/src/test/compile-fail-fulldeps/qquote.rs @@ -23,11 +23,11 @@ fn main() { let ps = syntax::parse::ParseSess::new(); let mut cx = syntax::ext::base::ExtCtxt::new( &ps, vec![], - syntax::ext::expand::ExpansionConfig::default("qquote".to_string())); + syntax::ext::expand::ExpansionConfig::default("qquote".to_owned())); cx.bt_push(syntax::codemap::ExpnInfo { call_site: DUMMY_SP, callee: syntax::codemap::NameAndSpan { - name: "".to_string(), + name: "".to_owned(), format: syntax::codemap::MacroBang, allow_internal_unstable: false, span: None, diff --git a/src/test/compile-fail/binop-bitxor-str.rs b/src/test/compile-fail/binop-bitxor-str.rs index 58cacc0b9f333..af77da9cfd123 100644 --- a/src/test/compile-fail/binop-bitxor-str.rs +++ b/src/test/compile-fail/binop-bitxor-str.rs @@ -10,4 +10,4 @@ // error-pattern:`^` cannot be applied to type `collections::string::String` -fn main() { let x = "a".to_string() ^ "b".to_string(); } +fn main() { let x = "a".to_owned() ^ "b".to_owned(); } diff --git a/src/test/compile-fail/borrowck-move-error-with-note.rs b/src/test/compile-fail/borrowck-move-error-with-note.rs index e4b9fb2671124..73dcd879c6cd2 100644 --- a/src/test/compile-fail/borrowck-move-error-with-note.rs +++ b/src/test/compile-fail/borrowck-move-error-with-note.rs @@ -35,7 +35,7 @@ impl Drop for S { } fn move_in_match() { - match (S {f: "foo".to_string(), g: "bar".to_string()}) { + match (S {f: "foo".to_owned(), g: "bar".to_owned()}) { S { //~ ERROR cannot move out of type `S`, which defines the `Drop` trait f: _s, //~ NOTE attempting to move value to here g: _t //~ NOTE and here 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 ec505faf88502..7312026f33777 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_string(); + let &_x = &"hi".to_owned(); //~^ ERROR cannot move out of borrowed content } 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 fffcf575ab08e..103ccbf8fa54f 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_string()); + let _x = *Rc::new("hi".to_owned()); //~^ ERROR cannot move out of borrowed content } diff --git a/src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs b/src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs index 3d13cbe30c5a2..493dd74367d61 100644 --- a/src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs +++ b/src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs @@ -14,14 +14,14 @@ impl Drop for S { } fn move_in_match() { - match (S {f:"foo".to_string()}) { + match (S {f:"foo".to_owned()}) { S {f:_s} => {} //~^ ERROR cannot move out of type `S`, which defines the `Drop` trait } } fn move_in_let() { - let S {f:_s} = S {f:"foo".to_string()}; + let S {f:_s} = S {f:"foo".to_owned()}; //~^ ERROR cannot move out of type `S`, which defines the `Drop` trait } diff --git a/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs b/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs index 625f71849057b..48383fabefd31 100644 --- a/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs +++ b/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs @@ -14,14 +14,14 @@ impl Drop for S { } fn move_in_match() { - match S("foo".to_string()) { + match S("foo".to_owned()) { S(_s) => {} //~^ ERROR cannot move out of type `S`, which defines the `Drop` trait } } fn move_in_let() { - let S(_s) = S("foo".to_string()); + let S(_s) = S("foo".to_owned()); //~^ ERROR cannot move out of type `S`, which defines the `Drop` trait } diff --git a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs index d9a2f89a9e21e..94e8c2d59cf3e 100644 --- a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs +++ b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs @@ -19,9 +19,9 @@ struct Foo { pub fn main() { let x = vec!( - Foo { string: "foo".to_string() }, - Foo { string: "bar".to_string() }, - Foo { string: "baz".to_string() } + Foo { string: "foo".to_owned() }, + Foo { string: "bar".to_owned() }, + Foo { string: "baz".to_owned() } ); let x: &[Foo] = &x; match x { diff --git a/src/test/compile-fail/borrowck-overloaded-call.rs b/src/test/compile-fail/borrowck-overloaded-call.rs index 93c37524bf565..304d30b1216b9 100644 --- a/src/test/compile-fail/borrowck-overloaded-call.rs +++ b/src/test/compile-fail/borrowck-overloaded-call.rs @@ -80,10 +80,10 @@ fn g() { fn h() { let s = SFnOnce { - x: "hello".to_string(), + x: "hello".to_owned(), }; - s(" world".to_string()); - s(" world".to_string()); //~ ERROR use of moved value: `s` + s(" world".to_owned()); + s(" world".to_owned()); //~ ERROR use of moved value: `s` } fn main() {} diff --git a/src/test/compile-fail/borrowck-overloaded-index-move-index.rs b/src/test/compile-fail/borrowck-overloaded-index-move-index.rs index d8615d1905338..11cfd1192bb24 100644 --- a/src/test/compile-fail/borrowck-overloaded-index-move-index.rs +++ b/src/test/compile-fail/borrowck-overloaded-index-move-index.rs @@ -54,7 +54,7 @@ fn main() { x: 1, y: 2, }; - let mut s = "hello".to_string(); + let mut s = "hello".to_owned(); let rs = &mut s; println!("{}", f[s]); diff --git a/src/test/compile-fail/borrowck-overloaded-index-ref-index.rs b/src/test/compile-fail/borrowck-overloaded-index-ref-index.rs index 4c50caf49768d..7bf9ad6b702c0 100644 --- a/src/test/compile-fail/borrowck-overloaded-index-ref-index.rs +++ b/src/test/compile-fail/borrowck-overloaded-index-ref-index.rs @@ -54,7 +54,7 @@ fn main() { x: 1, y: 2, }; - let mut s = "hello".to_string(); + let mut s = "hello".to_owned(); let rs = &mut s; println!("{}", f[&s]); //~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable diff --git a/src/test/compile-fail/borrowck-ref-into-rvalue.rs b/src/test/compile-fail/borrowck-ref-into-rvalue.rs index 726d4bcdf1d08..7330cd98933c7 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_string()) { + match Some("Hello".to_owned()) { Some(ref m) => { //~ ERROR borrowed value does not live long enough msg = m; }, diff --git a/src/test/compile-fail/by-move-pattern-binding.rs b/src/test/compile-fail/by-move-pattern-binding.rs index a49256d1bfc03..53218657a519d 100644 --- a/src/test/compile-fail/by-move-pattern-binding.rs +++ b/src/test/compile-fail/by-move-pattern-binding.rs @@ -20,7 +20,7 @@ struct S { fn f(x: String) {} fn main() { - let s = S { x: E::Bar("hello".to_string()) }; + let s = S { x: E::Bar("hello".to_owned()) }; match &s.x { &E::Foo => {} &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move diff --git a/src/test/compile-fail/check-static-values-constraints.rs b/src/test/compile-fail/check-static-values-constraints.rs index c3a1de11752f8..60160f06a4b00 100644 --- a/src/test/compile-fail/check-static-values-constraints.rs +++ b/src/test/compile-fail/check-static-values-constraints.rs @@ -116,7 +116,7 @@ static mut STATIC13: SafeStruct = SafeStruct{field1: SafeEnum::Variant1, static mut STATIC14: SafeStruct = SafeStruct { //~^ ERROR mutable statics are not allowed to have destructors field1: SafeEnum::Variant1, - field2: SafeEnum::Variant4("str".to_string()) + field2: SafeEnum::Variant4("str".to_owned()) //~^ ERROR method calls in statics are limited to constant inherent methods }; diff --git a/src/test/compile-fail/class-cast-to-trait.rs b/src/test/compile-fail/class-cast-to-trait.rs index af83b0ecbf22c..4fa5c9d10e4c5 100644 --- a/src/test/compile-fail/class-cast-to-trait.rs +++ b/src/test/compile-fail/class-cast-to-trait.rs @@ -59,6 +59,6 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { } fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; + let nyan: Box = box cat(0, 2, "nyan".to_owned()) as Box; nyan.eat(); //~ ERROR no method named `eat` found } diff --git a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs index 2621820c2229f..55fa4fed74a92 100644 --- a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs +++ b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs @@ -24,7 +24,7 @@ fn unwrap(x: X) -> String { } fn main() { - let x = X { x: "hello".to_string() }; + let x = X { x: "hello".to_owned() }; let y = unwrap(x); println!("contents: {}", y); } diff --git a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs index 5078009d4b222..2290fe4c4dd11 100644 --- a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs +++ b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs @@ -19,7 +19,7 @@ impl Drop for X { } fn main() { - let x = X { x: "hello".to_string() }; + let x = X { x: "hello".to_owned() }; match x { X { x: y } => println!("contents: {}", y) diff --git a/src/test/compile-fail/drop-with-active-borrows-1.rs b/src/test/compile-fail/drop-with-active-borrows-1.rs index 903365fb909f5..11dfba4a8663f 100644 --- a/src/test/compile-fail/drop-with-active-borrows-1.rs +++ b/src/test/compile-fail/drop-with-active-borrows-1.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let a = "".to_string(); + let a = "".to_owned(); let b: Vec<&str> = a.lines().collect(); drop(a); //~ ERROR cannot move out of `a` because it is borrowed for s in &b { diff --git a/src/test/compile-fail/drop-with-active-borrows-2.rs b/src/test/compile-fail/drop-with-active-borrows-2.rs index e6e1364dd2ca7..24ed771f71a51 100644 --- a/src/test/compile-fail/drop-with-active-borrows-2.rs +++ b/src/test/compile-fail/drop-with-active-borrows-2.rs @@ -9,7 +9,7 @@ // except according to those terms. fn read_lines_borrowed<'a>() -> Vec<&'a str> { - let raw_lines: Vec = vec!("foo ".to_string(), " bar".to_string()); + let raw_lines: Vec = vec!("foo ".to_owned(), " bar".to_owned()); raw_lines.iter().map(|l| l.trim()).collect() //~^ ERROR `raw_lines` does not live long enough } 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 d79b3f472d06b..a4696e9f28a70 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) {} fn main() { - check_bound("nocopy".to_string()); //~ ERROR the trait `core::marker::Copy` is not implemented + check_bound("nocopy".to_owned()); //~ ERROR the trait `core::marker::Copy` is not implemented } diff --git a/src/test/compile-fail/integral-indexing.rs b/src/test/compile-fail/integral-indexing.rs index e2fb0fa4f2fa5..1005c33412e37 100644 --- a/src/test/compile-fail/integral-indexing.rs +++ b/src/test/compile-fail/integral-indexing.rs @@ -10,7 +10,7 @@ pub fn main() { let v: Vec = vec!(0, 1, 2, 3, 4, 5); - let s: String = "abcdef".to_string(); + let s: String = "abcdef".to_owned(); v[3_usize]; v[3]; v[3u8]; //~ERROR the trait `core::ops::Index` is not implemented diff --git a/src/test/compile-fail/issue-13428.rs b/src/test/compile-fail/issue-13428.rs index c771970650d31..b7d2458ca28c5 100644 --- a/src/test/compile-fail/issue-13428.rs +++ b/src/test/compile-fail/issue-13428.rs @@ -19,7 +19,7 @@ fn foo() -> String { //~ ERROR not all control paths return a value } fn bar() -> String { //~ ERROR not all control paths return a value - "foobar".to_string() + "foobar".to_owned() ; //~ HELP consider removing this semicolon } diff --git a/src/test/compile-fail/issue-13497-2.rs b/src/test/compile-fail/issue-13497-2.rs index 31716837493c7..b6b0318d905a1 100644 --- a/src/test/compile-fail/issue-13497-2.rs +++ b/src/test/compile-fail/issue-13497-2.rs @@ -9,7 +9,7 @@ // except according to those terms. fn read_lines_borrowed<'a>() -> Vec<&'a str> { - let rawLines: Vec = vec!["foo ".to_string(), " bar".to_string()]; + let rawLines: Vec = vec!["foo ".to_owned(), " bar".to_owned()]; rawLines //~ ERROR `rawLines` does not live long enough .iter().map(|l| l.trim()).collect() } diff --git a/src/test/compile-fail/issue-13497.rs b/src/test/compile-fail/issue-13497.rs index d544a92d9c3b5..1cf28003e39b8 100644 --- a/src/test/compile-fail/issue-13497.rs +++ b/src/test/compile-fail/issue-13497.rs @@ -11,7 +11,7 @@ fn read_lines_borrowed1() -> Vec< &str //~ ERROR missing lifetime specifier > { - let rawLines: Vec = vec!["foo ".to_string(), " bar".to_string()]; + let rawLines: Vec = vec!["foo ".to_owned(), " bar".to_owned()]; rawLines.iter().map(|l| l.trim()).collect() } diff --git a/src/test/compile-fail/issue-2063.rs b/src/test/compile-fail/issue-2063.rs index 20bd8af7c3ef5..c4b248baa13bf 100644 --- a/src/test/compile-fail/issue-2063.rs +++ b/src/test/compile-fail/issue-2063.rs @@ -22,7 +22,7 @@ trait to_str_2 { // the compiler to attempt autoderef and then // try to resolve the method. impl to_str_2 for t { - fn my_to_string() -> String { "t".to_string() } + fn my_to_string() -> String { "t".to_owned() } } fn new_t(x: t) { diff --git a/src/test/compile-fail/issue-6458-4.rs b/src/test/compile-fail/issue-6458-4.rs index 7f408be9c02d4..6d8a3eee5ba3d 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 { - Err("bar".to_string()); + Err("bar".to_owned()); //~^ ERROR type annotations or generic parameter binding required } diff --git a/src/test/compile-fail/issue-7573.rs b/src/test/compile-fail/issue-7573.rs index 2d1cea1d44b74..3ee72a484c686 100644 --- a/src/test/compile-fail/issue-7573.rs +++ b/src/test/compile-fail/issue-7573.rs @@ -18,7 +18,7 @@ impl CrateId { fn new(s: &str) -> CrateId { CrateId { local_path: s.to_string(), - junk: "wutevs".to_string() + junk: "wutevs".to_owned() } } } diff --git a/src/test/compile-fail/lint-dead-code-4.rs b/src/test/compile-fail/lint-dead-code-4.rs index 3a9baecb9c60e..58d3a0bd934a9 100644 --- a/src/test/compile-fail/lint-dead-code-4.rs +++ b/src/test/compile-fail/lint-dead-code-4.rs @@ -38,7 +38,7 @@ enum XYZ { fn field_match_in_patterns(b: XYZ) -> String { match b { XYZ::Y { a, .. } => a, - _ => "".to_string() + _ => "".to_owned() } } diff --git a/src/test/compile-fail/match-vec-mismatch.rs b/src/test/compile-fail/match-vec-mismatch.rs index ef75213d34b85..fa740ca085260 100644 --- a/src/test/compile-fail/match-vec-mismatch.rs +++ b/src/test/compile-fail/match-vec-mismatch.rs @@ -11,7 +11,7 @@ #![feature(slice_patterns)] fn main() { - match "foo".to_string() { + match "foo".to_owned() { ['f', 'o', ..] => {} //~ ERROR mismatched types _ => { } } diff --git a/src/test/compile-fail/match-vec-unreachable.rs b/src/test/compile-fail/match-vec-unreachable.rs index 48b70b4bda08e..0f75f4d25d199 100644 --- a/src/test/compile-fail/match-vec-unreachable.rs +++ b/src/test/compile-fail/match-vec-unreachable.rs @@ -19,9 +19,9 @@ fn main() { _ => () } - let x: Vec = vec!["foo".to_string(), - "bar".to_string(), - "baz".to_string()]; + let x: Vec = vec!["foo".to_owned(), + "bar".to_owned(), + "baz".to_owned()]; let x: &[String] = &x; match x { [a, _, _, ..] => { println!("{}", a); } diff --git a/src/test/compile-fail/minus-string.rs b/src/test/compile-fail/minus-string.rs index 9a89424c61f34..b3a1dfebbd077 100644 --- a/src/test/compile-fail/minus-string.rs +++ b/src/test/compile-fail/minus-string.rs @@ -10,4 +10,4 @@ // error-pattern:cannot apply unary operator `-` to type `collections::string::String` -fn main() { -"foo".to_string(); } +fn main() { -"foo".to_owned(); } diff --git a/src/test/compile-fail/moves-based-on-type-access-to-field.rs b/src/test/compile-fail/moves-based-on-type-access-to-field.rs index b8572fbd2150d..705b731283315 100644 --- a/src/test/compile-fail/moves-based-on-type-access-to-field.rs +++ b/src/test/compile-fail/moves-based-on-type-access-to-field.rs @@ -16,7 +16,7 @@ fn consume(_s: String) {} fn touch(_a: &A) {} fn f20() { - let x = vec!("hi".to_string()); + let x = vec!("hi".to_owned()); consume(x.into_iter().next().unwrap()); touch(&x[0]); //~ ERROR use of moved value: `x` } 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 32fa773ec8079..9a7d9d10b3f97 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::thread; fn main() { - let x = "Hello world!".to_string(); + let x = "Hello world!".to_owned(); thread::spawn(move|| { 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 f30360af46eb4..07fa6b27cc497 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 { f: A } fn touch(_a: &A) {} fn f00() { - let x = "hi".to_string(); + let x = "hi".to_owned(); let _y = Foo { f:x }; //~ NOTE `x` moved here touch(&x); //~ ERROR use of moved value: `x` } fn f05() { - let x = "hi".to_string(); + let x = "hi".to_owned(); let _y = Foo { f:(((x))) }; //~ NOTE `x` moved here touch(&x); //~ ERROR use of moved value: `x` } fn f10() { - let x = "hi".to_string(); + let x = "hi".to_owned(); let _y = Foo { f:x.clone() }; touch(&x); } fn f20() { - let x = "hi".to_string(); + let x = "hi".to_owned(); let _y = Foo { f:(x).clone() }; touch(&x); } fn f30() { - let x = "hi".to_string(); + let x = "hi".to_owned(); let _y = Foo { f:((x)).clone() }; touch(&x); } fn f40() { - let x = "hi".to_string(); + let x = "hi".to_owned(); let _y = Foo { f:(((((((x)).clone()))))) }; touch(&x); } diff --git a/src/test/compile-fail/moves-based-on-type-exprs.rs b/src/test/compile-fail/moves-based-on-type-exprs.rs index 9ad44567a41f2..ec61c14b61578 100644 --- a/src/test/compile-fail/moves-based-on-type-exprs.rs +++ b/src/test/compile-fail/moves-based-on-type-exprs.rs @@ -17,13 +17,13 @@ fn guard(_s: String) -> bool {panic!()} fn touch(_a: &A) {} fn f10() { - let x = "hi".to_string(); + let x = "hi".to_owned(); let _y = Foo { f:x }; touch(&x); //~ ERROR use of moved value: `x` } fn f20() { - let x = "hi".to_string(); + let x = "hi".to_owned(); let _y = (x, 3); touch(&x); //~ ERROR use of moved value: `x` } @@ -35,8 +35,8 @@ fn f21() { } fn f30(cond: bool) { - let x = "hi".to_string(); - let y = "ho".to_string(); + let x = "hi".to_owned(); + let y = "ho".to_owned(); let _y = if cond { x } else { @@ -47,8 +47,8 @@ fn f30(cond: bool) { } fn f40(cond: bool) { - let x = "hi".to_string(); - let y = "ho".to_string(); + let x = "hi".to_owned(); + let y = "ho".to_owned(); let _y = match cond { true => x, false => y @@ -58,8 +58,8 @@ fn f40(cond: bool) { } fn f50(cond: bool) { - let x = "hi".to_string(); - let y = "ho".to_string(); + let x = "hi".to_owned(); + let y = "ho".to_owned(); let _y = match cond { _ if guard(x) => 10, true => 10, @@ -70,31 +70,31 @@ fn f50(cond: bool) { } fn f70() { - let x = "hi".to_string(); + let x = "hi".to_owned(); let _y = [x]; touch(&x); //~ ERROR use of moved value: `x` } fn f80() { - let x = "hi".to_string(); + let x = "hi".to_owned(); let _y = vec!(x); touch(&x); //~ ERROR use of moved value: `x` } fn f100() { - let x = vec!("hi".to_string()); + let x = vec!("hi".to_owned()); let _y = x.into_iter().next().unwrap(); touch(&x); //~ ERROR use of moved value: `x` } fn f110() { - let x = vec!("hi".to_string()); + let x = vec!("hi".to_owned()); let _y = [x.into_iter().next().unwrap(); 1]; touch(&x); //~ ERROR use of moved value: `x` } fn f120() { - let mut x = vec!("hi".to_string(), "ho".to_string()); + let mut x = vec!("hi".to_owned(), "ho".to_owned()); x.swap(0, 1); touch(&x[0]); touch(&x[1]); 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 7d209467caf2a..712f865784c57 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 {panic!()} fn touch(_a: &A) {} fn f10() { - let x = Foo {f: "hi".to_string()}; + let x = Foo {f: "hi".to_owned()}; 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 5af326b429849..a99aafd36fc07 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 @@ -22,7 +22,7 @@ struct R<'a> { } fn innocent_looking_victim() { - let mut x = Some("hello".to_string()); + let mut x = Some("hello".to_owned()); conspirator(|f, writer| { if writer { x = None; diff --git a/src/test/compile-fail/syntax-extension-minor.rs b/src/test/compile-fail/syntax-extension-minor.rs index d1e50638138c4..38a09143e3cd0 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_string(); - assert_eq!(concat_idents!(asd, f_f, dsa), "<.<".to_string()); + let asdf_fdsa = "<.<".to_owned(); + assert_eq!(concat_idents!(asd, f_f, dsa), "<.<".to_owned()); //~^ 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 9ba017e150e61..984f93c10ac8a 100644 --- a/src/test/compile-fail/trait-coercion-generic-regions.rs +++ b/src/test/compile-fail/trait-coercion-generic-regions.rs @@ -23,7 +23,7 @@ impl Trait<&'static str> for Struct { } fn main() { - let person = "Fred".to_string(); + let person = "Fred".to_owned(); let person: &str = &person; //~ ERROR `person` does not live long enough // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let s: Box> = Box::new(Struct { person: person }); diff --git a/src/test/compile-fail/type-params-in-different-spaces-1.rs b/src/test/compile-fail/type-params-in-different-spaces-1.rs index 155b835bbc6e0..7ef07cb8da135 100644 --- a/src/test/compile-fail/type-params-in-different-spaces-1.rs +++ b/src/test/compile-fail/type-params-in-different-spaces-1.rs @@ -24,6 +24,6 @@ impl> BrokenAdd for T {} pub fn main() { let foo: u8 = 0; - let x: u8 = foo.broken_add("hello darkness my old friend".to_string()); + let x: u8 = foo.broken_add("hello darkness my old friend".to_owned()); println!("{}", x); } diff --git a/src/test/compile-fail/ufcs-qpath-missing-params.rs b/src/test/compile-fail/ufcs-qpath-missing-params.rs index 2e8f9d42e7895..95a0a820f9664 100644 --- a/src/test/compile-fail/ufcs-qpath-missing-params.rs +++ b/src/test/compile-fail/ufcs-qpath-missing-params.rs @@ -11,6 +11,6 @@ use std::borrow::IntoCow; fn main() { - ::into_cow("foo".to_string()); + ::into_cow("foo".to_owned()); //~^ ERROR too few type parameters provided: expected 1 parameter } 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 e2167ca446f2c..28eb4a12739fb 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_string(); + let x = "Hello!".to_owned(); let _y = x; println!("{}", x); //~ ERROR use of moved value } diff --git a/src/test/compile-fail/walk-struct-literal-with.rs b/src/test/compile-fail/walk-struct-literal-with.rs index 10503084b9d9f..198436261ec52 100644 --- a/src/test/compile-fail/walk-struct-literal-with.rs +++ b/src/test/compile-fail/walk-struct-literal-with.rs @@ -15,13 +15,13 @@ struct Mine{ impl Mine{ fn make_string_bar(mut self) -> Mine{ - self.test = "Bar".to_string(); + self.test = "Bar".to_owned(); self } } fn main(){ - let start = Mine{test:"Foo".to_string(), other_val:0}; + let start = Mine{test:"Foo".to_owned(), other_val:0}; let end = Mine{other_val:1, ..start.make_string_bar()}; println!("{}", start.test); //~ ERROR use of moved value: `start.test` } diff --git a/src/test/debuginfo/pretty-std.rs b/src/test/debuginfo/pretty-std.rs index 576621737e6b6..4c69f690e52b6 100644 --- a/src/test/debuginfo/pretty-std.rs +++ b/src/test/debuginfo/pretty-std.rs @@ -75,7 +75,7 @@ fn main() { let str_slice = "IAMA string slice!"; // String - let string = "IAMA string!".to_string(); + let string = "IAMA string!".to_owned(); // Option let some = Some(8i16); diff --git a/src/test/parse-fail/circular_modules_main.rs b/src/test/parse-fail/circular_modules_main.rs index 861d4cd12ab5c..719abc383b700 100644 --- a/src/test/parse-fail/circular_modules_main.rs +++ b/src/test/parse-fail/circular_modules_main.rs @@ -14,7 +14,7 @@ mod circular_modules_hello; //~ ERROR: circular modules pub fn hi_str() -> String { - "Hi!".to_string() + "Hi!".to_owned() } fn main() { diff --git a/src/test/parse-fail/issue-10412.rs b/src/test/parse-fail/issue-10412.rs index 0b9456bc080d9..85824c9f5a927 100644 --- a/src/test/parse-fail/issue-10412.rs +++ b/src/test/parse-fail/issue-10412.rs @@ -28,7 +28,7 @@ impl<'self> Serializable for &'self str { //~ ERROR no longer a special lif fn main() { println!("hello"); - let x = "foo".to_string(); + let x = "foo".to_owned(); let y = x; println!("{}", y); } diff --git a/src/test/parse-fail/multitrait.rs b/src/test/parse-fail/multitrait.rs index a1c737609d14a..1c3bd9361f433 100644 --- a/src/test/parse-fail/multitrait.rs +++ b/src/test/parse-fail/multitrait.rs @@ -17,5 +17,5 @@ struct S { impl Cmp, ToString for S { //~^ ERROR: expected one of `(`, `+`, `..`, `::`, `<`, `for`, `where`, or `{`, found `,` fn eq(&&other: S) { false } - fn to_string(&self) -> String { "hi".to_string() } + fn to_string(&self) -> String { "hi".to_owned() } } diff --git a/src/test/pretty/match-naked-expr-medium.rs b/src/test/pretty/match-naked-expr-medium.rs index 39af19dbf6f36..f7bdf26b1ec77 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_string(), "not".to_string(), "SO".to_string(), - "long".to_string(), "string".to_string()], + ["some(_)".to_owned(), "not".to_owned(), "SO".to_owned(), + "long".to_owned(), "string".to_owned()], None => - ["none".to_string(), "a".to_string(), "a".to_string(), - "a".to_string(), "a".to_string()], + ["none".to_owned(), "a".to_owned(), "a".to_owned(), + "a".to_owned(), "a".to_owned()], }; } diff --git a/src/test/pretty/match-naked-expr.rs b/src/test/pretty/match-naked-expr.rs index 02bbf667d96bc..18286c1bbf79e 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_string(), - None => "none".to_string(), + Some(_) => "some(_)".to_owned(), + None => "none".to_owned(), }; } diff --git a/src/test/run-fail-fulldeps/qquote.rs b/src/test/run-fail-fulldeps/qquote.rs index 4251579bbdcd1..80e503fc47ea9 100644 --- a/src/test/run-fail-fulldeps/qquote.rs +++ b/src/test/run-fail-fulldeps/qquote.rs @@ -25,11 +25,11 @@ fn main() { let ps = syntax::parse::ParseSess::new(); let mut cx = syntax::ext::base::ExtCtxt::new( &ps, vec![], - syntax::ext::expand::ExpansionConfig::default("qquote".to_string())); + syntax::ext::expand::ExpansionConfig::default("qquote".to_owned())); cx.bt_push(syntax::codemap::ExpnInfo { call_site: DUMMY_SP, callee: syntax::codemap::NameAndSpan { - name: "".to_string(), + name: "".to_owned(), format: syntax::codemap::MacroBang, allow_internal_unstable: false, span: None, diff --git a/src/test/run-fail/assert-macro-owned.rs b/src/test/run-fail/assert-macro-owned.rs index e68aef10de891..c5e867478e70b 100644 --- a/src/test/run-fail/assert-macro-owned.rs +++ b/src/test/run-fail/assert-macro-owned.rs @@ -11,5 +11,5 @@ // error-pattern:panicked at 'test-assert-owned' fn main() { - assert!(false, "test-assert-owned".to_string()); + assert!(false, "test-assert-owned".to_owned()); } diff --git a/src/test/run-fail/binop-panic.rs b/src/test/run-fail/binop-panic.rs index 159c33198a6e4..f270f3206a019 100644 --- a/src/test/run-fail/binop-panic.rs +++ b/src/test/run-fail/binop-panic.rs @@ -10,4 +10,4 @@ // error-pattern:quux fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); } -fn main() { 3_usize == my_err("bye".to_string()); } +fn main() { 3_usize == my_err("bye".to_owned()); } diff --git a/src/test/run-fail/fmt-panic.rs b/src/test/run-fail/fmt-panic.rs index 22e81480867a9..371a3123c9875 100644 --- a/src/test/run-fail/fmt-panic.rs +++ b/src/test/run-fail/fmt-panic.rs @@ -11,6 +11,6 @@ // error-pattern:meh fn main() { - let str_var: String = "meh".to_string(); + let str_var: String = "meh".to_owned(); panic!("{}", str_var); } diff --git a/src/test/run-fail/if-cond-bot.rs b/src/test/run-fail/if-cond-bot.rs index f38b00ab46d90..aa98f92997a32 100644 --- a/src/test/run-fail/if-cond-bot.rs +++ b/src/test/run-fail/if-cond-bot.rs @@ -10,4 +10,4 @@ // error-pattern:quux fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); } -fn main() { if my_err("bye".to_string()) { } } +fn main() { if my_err("bye".to_owned()) { } } diff --git a/src/test/run-fail/panic-task-name-owned.rs b/src/test/run-fail/panic-task-name-owned.rs index 561f141100ca7..6306db6f83696 100644 --- a/src/test/run-fail/panic-task-name-owned.rs +++ b/src/test/run-fail/panic-task-name-owned.rs @@ -13,7 +13,7 @@ use std::thread::Builder; fn main() { - let r: () = Builder::new().name("owned name".to_string()).spawn(move|| { + let r: () = Builder::new().name("owned name".to_owned()).spawn(move|| { panic!("test"); () }).unwrap().join().unwrap(); diff --git a/src/test/run-fail/result-get-panic.rs b/src/test/run-fail/result-get-panic.rs index dbded1075442c..1072f5a2c955a 100644 --- a/src/test/run-fail/result-get-panic.rs +++ b/src/test/run-fail/result-get-panic.rs @@ -13,5 +13,5 @@ use std::result::Result::Err; fn main() { - println!("{}", Err::("kitty".to_string()).unwrap()); + println!("{}", Err::("kitty".to_owned()).unwrap()); } diff --git a/src/test/run-fail/str-overrun.rs b/src/test/run-fail/str-overrun.rs index a9c0030fecaf7..49b00452c04b6 100644 --- a/src/test/run-fail/str-overrun.rs +++ b/src/test/run-fail/str-overrun.rs @@ -11,7 +11,7 @@ // error-pattern:index out of bounds: the len is 5 but the index is 5 fn main() { - let s: String = "hello".to_string(); + let s: String = "hello".to_owned(); // Bounds-check panic. assert_eq!(s.as_bytes()[5], 0x0 as u8); diff --git a/src/test/run-make/debug-assertions/debug.rs b/src/test/run-make/debug-assertions/debug.rs index a0ccc75afd05b..dcba0316cc8dc 100644 --- a/src/test/run-make/debug-assertions/debug.rs +++ b/src/test/run-make/debug-assertions/debug.rs @@ -14,7 +14,7 @@ use std::env; use std::thread; fn main() { - let should_fail = env::args().nth(1) == Some("bad".to_string()); + let should_fail = env::args().nth(1) == Some("bad".to_owned()); assert_eq!(thread::spawn(debug_assert_eq).join().is_err(), should_fail); assert_eq!(thread::spawn(debug_assert).join().is_err(), should_fail); diff --git a/src/test/run-make/execution-engine/test.rs b/src/test/run-make/execution-engine/test.rs index ba6d0d246e4e4..9902f1c575a05 100644 --- a/src/test/run-make/execution-engine/test.rs +++ b/src/test/run-make/execution-engine/test.rs @@ -201,7 +201,7 @@ fn build_exec_options(sysroot: PathBuf) -> Options { fn compile_program(input: &str, sysroot: PathBuf) -> Option<(llvm::ModuleRef, Vec)> { let input = Input::Str(input.to_string()); - let thread = Builder::new().name("compile_program".to_string()); + let thread = Builder::new().name("compile_program".to_owned()); let handle = thread.spawn(move || { let opts = build_exec_options(sysroot); @@ -210,7 +210,7 @@ fn compile_program(input: &str, sysroot: PathBuf) let cfg = build_configuration(&sess); - let id = "input".to_string(); + let id = "input".to_owned(); let krate = driver::phase_1_parse_input(&sess, cfg, &input); diff --git a/src/test/run-make/save-analysis/foo.rs b/src/test/run-make/save-analysis/foo.rs index 07b99dff4e0fa..7e49831fd5109 100644 --- a/src/test/run-make/save-analysis/foo.rs +++ b/src/test/run-make/save-analysis/foo.rs @@ -289,7 +289,7 @@ pub struct blah { fn main() { // foo let s = box some_fields {field1: 43}; - hello((43, "a".to_string()), *s); + hello((43, "a".to_owned()), *s); sub::sub2::hello(); sub2::sub3::hello(); @@ -319,8 +319,8 @@ fn main() { // foo let s4: msalias::nested_struct = sub2::nested_struct{ field2: 55}; println(&s2.field1.to_string()); let s5: MyType = box some_fields{ field1: 55}; - let s = SameDir::SameStruct{name: "Bob".to_string()}; - let s = SubDir::SubStruct{name:"Bob".to_string()}; + let s = SameDir::SameStruct{name: "Bob".to_owned()}; + let s = SubDir::SubStruct{name:"Bob".to_owned()}; let s6: SomeEnum = SomeEnum::MyTypes(box s2.clone(), s5); let s7: SomeEnum = SomeEnum::Strings("one", "two", "three"); matchSomeEnum(s6); diff --git a/src/test/run-pass-fulldeps/compiler-calls.rs b/src/test/run-pass-fulldeps/compiler-calls.rs index 1cf36dab395fd..e6222891db4d2 100644 --- a/src/test/run-pass-fulldeps/compiler-calls.rs +++ b/src/test/run-pass-fulldeps/compiler-calls.rs @@ -76,7 +76,7 @@ impl<'a> CompilerCalls<'a> for TestCalls { fn main() { let mut tc = TestCalls { count: 1 }; // we should never get use this filename, but lets make sure they are valid args. - let args = vec!["compiler-calls".to_string(), "foo.rs".to_string()]; + let args = vec!["compiler-calls".to_owned(), "foo.rs".to_owned()]; rustc_driver::run_compiler(&args, &mut tc); assert!(tc.count == 30); } diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs index 6670f200ba71e..f29e941d4e549 100644 --- a/src/test/run-pass-fulldeps/qquote.rs +++ b/src/test/run-pass-fulldeps/qquote.rs @@ -21,11 +21,11 @@ fn main() { let ps = syntax::parse::ParseSess::new(); let mut cx = syntax::ext::base::ExtCtxt::new( &ps, vec![], - syntax::ext::expand::ExpansionConfig::default("qquote".to_string())); + syntax::ext::expand::ExpansionConfig::default("qquote".to_owned())); cx.bt_push(syntax::codemap::ExpnInfo { call_site: DUMMY_SP, callee: syntax::codemap::NameAndSpan { - name: "".to_string(), + name: "".to_owned(), format: syntax::codemap::MacroBang, allow_internal_unstable: false, span: None, diff --git a/src/test/run-pass/assert-eq-macro-success.rs b/src/test/run-pass/assert-eq-macro-success.rs index 9662e1ff33d11..10fabb11a2b61 100644 --- a/src/test/run-pass/assert-eq-macro-success.rs +++ b/src/test/run-pass/assert-eq-macro-success.rs @@ -13,7 +13,7 @@ struct Point { x : isize } pub fn main() { assert_eq!(14,14); - assert_eq!("abc".to_string(),"abc".to_string()); + assert_eq!("abc".to_owned(),"abc".to_owned()); assert_eq!(Box::new(Point{x:34}),Box::new(Point{x:34})); assert_eq!(&Point{x:34},&Point{x:34}); } diff --git a/src/test/run-pass/autobind.rs b/src/test/run-pass/autobind.rs index 1f3d17ad55c08..b876053fa3379 100644 --- a/src/test/run-pass/autobind.rs +++ b/src/test/run-pass/autobind.rs @@ -17,6 +17,6 @@ fn g(act: F) -> isize where F: FnOnce(Vec) -> isize { return act(vec!( pub fn main() { assert_eq!(g(f), 1); let f1 = f; - assert_eq!(f1(vec!["x".to_string(), "y".to_string(), "z".to_string()]), - "x".to_string()); + assert_eq!(f1(vec!["x".to_owned(), "y".to_owned(), "z".to_owned()]), + "x".to_owned()); } diff --git a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs index 05f12fd089ad4..582db1621358e 100644 --- a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs +++ b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs @@ -31,5 +31,5 @@ impl Foo for usize { pub fn main() { let x: Box<_> = box 3; - assert_eq!(x.foo(), "box 3".to_string()); + assert_eq!(x.foo(), "box 3".to_owned()); } diff --git a/src/test/run-pass/bare-fn-implements-fn-mut.rs b/src/test/run-pass/bare-fn-implements-fn-mut.rs index e8118e90a9f3f..dee50590d6738 100644 --- a/src/test/run-pass/bare-fn-implements-fn-mut.rs +++ b/src/test/run-pass/bare-fn-implements-fn-mut.rs @@ -32,6 +32,6 @@ fn g(mut x: String, y: String) -> String { fn main() { call_f(f); - assert_eq!(call_g(g, "foo".to_string(), "bar".to_string()), + assert_eq!(call_g(g, "foo".to_owned(), "bar".to_owned()), "foobar"); } diff --git a/src/test/run-pass/block-explicit-types.rs b/src/test/run-pass/block-explicit-types.rs index 835d356d8aaa1..bb0fa0fd871ad 100644 --- a/src/test/run-pass/block-explicit-types.rs +++ b/src/test/run-pass/block-explicit-types.rs @@ -10,5 +10,5 @@ pub fn main() { fn as_buf(s: String, f: F) -> T where F: FnOnce(String) -> T { f(s) } - as_buf("foo".to_string(), |foo: String| -> () { println!("{}", foo) }); + as_buf("foo".to_owned(), |foo: String| -> () { println!("{}", foo) }); } diff --git a/src/test/run-pass/borrowed-ptr-pattern-2.rs b/src/test/run-pass/borrowed-ptr-pattern-2.rs index 3e47764ba0264..d205bda5edd2a 100644 --- a/src/test/run-pass/borrowed-ptr-pattern-2.rs +++ b/src/test/run-pass/borrowed-ptr-pattern-2.rs @@ -17,6 +17,6 @@ fn foo(s: &String) -> bool { } pub fn main() { - assert!(foo(&"kitty".to_string())); - assert!(!foo(&"gata".to_string())); + assert!(foo(&"kitty".to_owned())); + assert!(!foo(&"gata".to_owned())); } diff --git a/src/test/run-pass/bug-7183-generics.rs b/src/test/run-pass/bug-7183-generics.rs index 80fd09114fc95..1d9194e2daa68 100644 --- a/src/test/run-pass/bug-7183-generics.rs +++ b/src/test/run-pass/bug-7183-generics.rs @@ -35,11 +35,11 @@ impl Speak for Option { pub fn main() { - assert_eq!(3.hi(), "hello: 3".to_string()); + assert_eq!(3.hi(), "hello: 3".to_owned()); assert_eq!(Some(Some(3)).hi(), - "something!something!hello: 3".to_string()); - assert_eq!(None::.hi(), "hello - none".to_string()); + "something!something!hello: 3".to_owned()); + assert_eq!(None::.hi(), "hello - none".to_owned()); - assert_eq!(Some(None::).hi(), "something!hello - none".to_string()); - assert_eq!(Some(3).hi(), "something!hello: 3".to_string()); + assert_eq!(Some(None::).hi(), "something!hello - none".to_owned()); + assert_eq!(Some(3).hi(), "something!hello: 3".to_owned()); } diff --git a/src/test/run-pass/c-stack-returning-int64.rs b/src/test/run-pass/c-stack-returning-int64.rs index d6b35f5385a42..548344a46ad9c 100644 --- a/src/test/run-pass/c-stack-returning-int64.rs +++ b/src/test/run-pass/c-stack-returning-int64.rs @@ -36,7 +36,7 @@ fn atoll(s: String) -> i64 { } pub fn main() { - assert_eq!(atol("1024".to_string()) * 10, atol("10240".to_string())); - assert!((atoll("11111111111111111".to_string()) * 10) == - atoll("111111111111111110".to_string())); + assert_eq!(atol("1024".to_owned()) * 10, atol("10240".to_owned())); + assert!((atoll("11111111111111111".to_owned()) * 10) == + atoll("111111111111111110".to_owned())); } diff --git a/src/test/run-pass/cci_nested_exe.rs b/src/test/run-pass/cci_nested_exe.rs index e4f4a4f3a576c..7b017bd4f6368 100644 --- a/src/test/run-pass/cci_nested_exe.rs +++ b/src/test/run-pass/cci_nested_exe.rs @@ -18,14 +18,14 @@ use cci_nested_lib::*; pub fn main() { let lst = new_int_alist(); - 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()); + 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()); let lst = new_int_alist_2(); - 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()); + 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()); } diff --git a/src/test/run-pass/child-outlives-parent.rs b/src/test/run-pass/child-outlives-parent.rs index 7da1416602f6d..8900e749c09b0 100644 --- a/src/test/run-pass/child-outlives-parent.rs +++ b/src/test/run-pass/child-outlives-parent.rs @@ -19,5 +19,5 @@ use std::thread; fn child2(_s: String) { } pub fn main() { - let _x = thread::spawn(move|| child2("hi".to_string())); + let _x = thread::spawn(move|| child2("hi".to_owned())); } diff --git a/src/test/run-pass/class-attributes-1.rs b/src/test/run-pass/class-attributes-1.rs index 5dc27472184d7..87b934f9b4993 100644 --- a/src/test/run-pass/class-attributes-1.rs +++ b/src/test/run-pass/class-attributes-1.rs @@ -25,4 +25,4 @@ impl Drop for cat { #[cat_maker] fn cat(name: String) -> cat { cat{name: name,} } -pub fn main() { let _kitty = cat("Spotty".to_string()); } +pub fn main() { let _kitty = cat("Spotty".to_owned()); } diff --git a/src/test/run-pass/class-attributes-2.rs b/src/test/run-pass/class-attributes-2.rs index cc1b15bcb81cd..c120b0a1ed941 100644 --- a/src/test/run-pass/class-attributes-2.rs +++ b/src/test/run-pass/class-attributes-2.rs @@ -35,5 +35,5 @@ fn cat(name: String) -> cat { } pub fn main() { - let _kitty = cat("Spotty".to_string()); + let _kitty = cat("Spotty".to_owned()); } diff --git a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs index da51ad761c70a..3c866effefda2 100644 --- a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs +++ b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs @@ -25,6 +25,6 @@ fn print_out(thing: Box, expected: String) { } pub fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; - print_out(nyan, "nyan".to_string()); + let nyan: Box = box cat(0, 2, "nyan".to_owned()) as Box; + print_out(nyan, "nyan".to_owned()); } diff --git a/src/test/run-pass/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/class-cast-to-trait-multiple-types.rs index e5acad3a3ad34..dc53647ec432b 100644 --- a/src/test/run-pass/class-cast-to-trait-multiple-types.rs +++ b/src/test/run-pass/class-cast-to-trait-multiple-types.rs @@ -92,7 +92,7 @@ fn annoy_neighbors(critter: &mut noisy) { } pub fn main() { - let mut nyan: cat = cat(0_usize, 2, "nyan".to_string()); + let mut nyan: cat = cat(0_usize, 2, "nyan".to_owned()); let mut whitefang: dog = dog(); annoy_neighbors(&mut nyan); annoy_neighbors(&mut whitefang); diff --git a/src/test/run-pass/class-cast-to-trait.rs b/src/test/run-pass/class-cast-to-trait.rs index adb0b6cd0a75f..5adc2b54c2442 100644 --- a/src/test/run-pass/class-cast-to-trait.rs +++ b/src/test/run-pass/class-cast-to-trait.rs @@ -59,7 +59,7 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { pub fn main() { - let mut nyan = cat(0, 2, "nyan".to_string()); + let mut nyan = cat(0, 2, "nyan".to_owned()); let mut nyan: &mut noisy = &mut nyan; nyan.speak(); } diff --git a/src/test/run-pass/class-exports.rs b/src/test/run-pass/class-exports.rs index 6783609b256c9..40d5f04ab5432 100644 --- a/src/test/run-pass/class-exports.rs +++ b/src/test/run-pass/class-exports.rs @@ -33,6 +33,6 @@ mod kitty { } pub fn main() { - assert_eq!(cat("Spreckles".to_string()).get_name(), - "Spreckles".to_string()); + assert_eq!(cat("Spreckles".to_owned()).get_name(), + "Spreckles".to_owned()); } diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index 4c494293b517e..b759cf542f832 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -102,9 +102,9 @@ impl cat { } pub fn main() { - let mut nyan: cat = cat::new(0, 2, "nyan".to_string()); + let mut nyan: cat = cat::new(0, 2, "nyan".to_owned()); for _ in 1_usize..5 { nyan.speak(); } - assert!(*nyan.find(&1).unwrap() == "nyan".to_string()); + assert!(*nyan.find(&1).unwrap() == "nyan".to_owned()); assert_eq!(nyan.find(&10), None); let mut spotty: cat = cat::new(2, 57, cat_type::tuxedo); for _ in 0_usize..6 { spotty.speak(); } diff --git a/src/test/run-pass/class-implement-trait-cross-crate.rs b/src/test/run-pass/class-implement-trait-cross-crate.rs index 5a1dc930efa54..791160c75f293 100644 --- a/src/test/run-pass/class-implement-trait-cross-crate.rs +++ b/src/test/run-pass/class-implement-trait-cross-crate.rs @@ -57,7 +57,7 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { pub fn main() { - let mut nyan = cat(0_usize, 2, "nyan".to_string()); + let mut nyan = cat(0_usize, 2, "nyan".to_owned()); nyan.eat(); assert!((!nyan.eat())); for _ in 1_usize..10_usize { nyan.speak(); }; diff --git a/src/test/run-pass/class-implement-traits.rs b/src/test/run-pass/class-implement-traits.rs index 394af6b9ecd51..9696e41c88227 100644 --- a/src/test/run-pass/class-implement-traits.rs +++ b/src/test/run-pass/class-implement-traits.rs @@ -62,7 +62,7 @@ fn make_speak(mut c: C) { } pub fn main() { - let mut nyan = cat(0_usize, 2, "nyan".to_string()); + let mut nyan = cat(0_usize, 2, "nyan".to_owned()); nyan.eat(); assert!((!nyan.eat())); for _ in 1_usize..10_usize { 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 4d247bde190de..537ba41e5e124 100644 --- a/src/test/run-pass/class-poly-methods-cross-crate.rs +++ b/src/test/run-pass/class-poly-methods-cross-crate.rs @@ -15,11 +15,11 @@ use cci_class_6::kitties::cat; pub fn main() { let mut nyan : cat = cat::(52_usize, 99, vec!('p')); - let mut kitty = cat(1000_usize, 2, vec!("tabby".to_string())); + let mut kitty = cat(1000_usize, 2, vec!("tabby".to_owned())); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); nyan.speak(vec!(1_usize,2_usize,3_usize)); assert_eq!(nyan.meow_count(), 55_usize); - kitty.speak(vec!("meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string())); + kitty.speak(vec!("meow".to_owned(), "mew".to_owned(), "purr".to_owned(), "chirp".to_owned())); assert_eq!(kitty.meow_count(), 1004_usize); } diff --git a/src/test/run-pass/class-poly-methods.rs b/src/test/run-pass/class-poly-methods.rs index 2528ff5128f9c..ac3dbcdfeef30 100644 --- a/src/test/run-pass/class-poly-methods.rs +++ b/src/test/run-pass/class-poly-methods.rs @@ -34,11 +34,11 @@ fn cat(in_x : usize, in_y : isize, in_info: Vec ) -> cat { pub fn main() { let mut nyan : cat = cat::(52, 99, vec!(9)); - let mut kitty = cat(1000, 2, vec!("tabby".to_string())); + let mut kitty = cat(1000, 2, vec!("tabby".to_owned())); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); nyan.speak(vec!(1,2,3)); assert_eq!(nyan.meow_count(), 55); - kitty.speak(vec!("meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string())); + kitty.speak(vec!("meow".to_owned(), "mew".to_owned(), "purr".to_owned(), "chirp".to_owned())); assert_eq!(kitty.meow_count(), 1004); } diff --git a/src/test/run-pass/class-separate-impl.rs b/src/test/run-pass/class-separate-impl.rs index 52853658c825b..c62ab2c609dc3 100644 --- a/src/test/run-pass/class-separate-impl.rs +++ b/src/test/run-pass/class-separate-impl.rs @@ -67,6 +67,6 @@ fn print_out(thing: Box, expected: String) { } pub fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; - print_out(nyan, "nyan".to_string()); + let nyan: Box = box cat(0, 2, "nyan".to_owned()) as Box; + print_out(nyan, "nyan".to_owned()); } diff --git a/src/test/run-pass/class-str-field.rs b/src/test/run-pass/class-str-field.rs index e3b9b56db0b5b..f46007577432a 100644 --- a/src/test/run-pass/class-str-field.rs +++ b/src/test/run-pass/class-str-field.rs @@ -23,5 +23,5 @@ fn cat(in_name: String) -> cat { } pub fn main() { - let _nyan = cat("nyan".to_string()); + let _nyan = cat("nyan".to_owned()); } diff --git a/src/test/run-pass/classes-cross-crate.rs b/src/test/run-pass/classes-cross-crate.rs index 3d99aa1ef1d08..e060804b930e1 100644 --- a/src/test/run-pass/classes-cross-crate.rs +++ b/src/test/run-pass/classes-cross-crate.rs @@ -14,7 +14,7 @@ extern crate cci_class_4; use cci_class_4::kitties::cat; pub fn main() { - let mut nyan = cat(0_usize, 2, "nyan".to_string()); + let mut nyan = cat(0_usize, 2, "nyan".to_owned()); nyan.eat(); assert!((!nyan.eat())); for _ in 1_usize..10_usize { nyan.speak(); }; diff --git a/src/test/run-pass/classes.rs b/src/test/run-pass/classes.rs index fa0dda11233a8..cd6b005b17d45 100644 --- a/src/test/run-pass/classes.rs +++ b/src/test/run-pass/classes.rs @@ -49,7 +49,7 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { } pub fn main() { - let mut nyan = cat(0_usize, 2, "nyan".to_string()); + let mut nyan = cat(0_usize, 2, "nyan".to_owned()); nyan.eat(); assert!((!nyan.eat())); for _ in 1_usize..10_usize { nyan.speak(); }; diff --git a/src/test/run-pass/cleanup-shortcircuit.rs b/src/test/run-pass/cleanup-shortcircuit.rs index 0cfe739018c85..19de7a5ca8c92 100644 --- a/src/test/run-pass/cleanup-shortcircuit.rs +++ b/src/test/run-pass/cleanup-shortcircuit.rs @@ -27,9 +27,9 @@ use std::env; pub fn main() { let args: Vec = env::args().collect(); - // Here, the rvalue `"signal".to_string()` requires cleanup. Older versions + // Here, the rvalue `"signal".to_owned()` 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_string()` + // expression was the end of the `if`, and as the `"signal".to_owned()` // expression was never evaluated, we wound up trying to clean // uninitialized memory. diff --git a/src/test/run-pass/closure-reform.rs b/src/test/run-pass/closure-reform.rs index 0fa67e873f89c..1c0add06b1407 100644 --- a/src/test/run-pass/closure-reform.rs +++ b/src/test/run-pass/closure-reform.rs @@ -16,7 +16,7 @@ fn call_it(f: F) where F : FnOnce(String) -> String { - println!("{}", f("Fred".to_string())) + println!("{}", f("Fred".to_owned())) } fn call_a_thunk(f: F) where F: FnOnce() { @@ -38,15 +38,15 @@ fn call_bare_again(f: extern "Rust" fn(&str)) { pub fn main() { // Procs - let greeting = "Hello ".to_string(); + let greeting = "Hello ".to_owned(); call_it(|s| { format!("{}{}", greeting, s) }); - let greeting = "Goodbye ".to_string(); + let greeting = "Goodbye ".to_owned(); call_it(|s| format!("{}{}", greeting, s)); - let greeting = "How's life, ".to_string(); + let greeting = "How's life, ".to_owned(); call_it(|s: String| -> String { format!("{}{}", greeting, s) }); diff --git a/src/test/run-pass/complex.rs b/src/test/run-pass/complex.rs index 6bb9503c2b0e4..221124d5d188c 100644 --- a/src/test/run-pass/complex.rs +++ b/src/test/run-pass/complex.rs @@ -19,14 +19,14 @@ fn putstr(_s: String) { } fn putint(_i: isize) { let mut i: isize = 33; - while i < 36 { putstr("hi".to_string()); i = i + 1; } + while i < 36 { putstr("hi".to_owned()); i = i + 1; } } fn zerg(i: isize) -> isize { return i; } fn foo(x: isize) -> isize { let mut y: t = x + 2; - putstr("hello".to_string()); + putstr("hello".to_owned()); while y < 10 { putint(y); if y * 3 == 4 { y = y + 2; nothing(); } } let mut z: t; z = 0x55; diff --git a/src/test/run-pass/concat.rs b/src/test/run-pass/concat.rs index 9a2390a9e68d3..4e19e9fd0fc15 100644 --- a/src/test/run-pass/concat.rs +++ b/src/test/run-pass/concat.rs @@ -10,10 +10,10 @@ pub fn main() { - assert_eq!(format!(concat!("foo", "bar", "{}"), "baz"), "foobarbaz".to_string()); - assert_eq!(format!(concat!()), "".to_string()); + assert_eq!(format!(concat!("foo", "bar", "{}"), "baz"), "foobarbaz".to_owned()); + assert_eq!(format!(concat!()), "".to_owned()); // check trailing comma is allowed in concat - assert_eq!(concat!("qux", "quux",).to_string(), "quxquux".to_string()); + assert_eq!(concat!("qux", "quux",).to_string(), "quxquux".to_owned()); assert_eq!( concat!(1, 2, 3, 4f32, 4.0, 'a', true), diff --git a/src/test/run-pass/const-bound.rs b/src/test/run-pass/const-bound.rs index 72a23b998e5a1..2f12c00e6fdcd 100644 --- a/src/test/run-pass/const-bound.rs +++ b/src/test/run-pass/const-bound.rs @@ -19,7 +19,7 @@ struct F { field: isize } pub fn main() { /*foo(1); - foo("hi".to_string()); + foo("hi".to_owned()); foo(vec![1, 2, 3]); foo(F{field: 42}); foo((1, 2)); diff --git a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs index 43507f0cb00bd..2f0e35c765252 100644 --- a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs +++ b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs @@ -27,5 +27,5 @@ pub fn main() { let x: Box<_> = box () (); x.cx(); let y = (); - y.add("hi".to_string()); + y.add("hi".to_owned()); } diff --git a/src/test/run-pass/deriving-hash.rs b/src/test/run-pass/deriving-hash.rs index 287750e5051c7..06fd8d30adc7e 100644 --- a/src/test/run-pass/deriving-hash.rs +++ b/src/test/run-pass/deriving-hash.rs @@ -27,12 +27,12 @@ fn hash(t: &T) -> u64 { fn main() { let person1 = Person { id: 5, - name: "Janet".to_string(), + name: "Janet".to_owned(), phone: 555_666_7777 }; let person2 = Person { id: 5, - name: "Bob".to_string(), + name: "Bob".to_owned(), phone: 555_666_7777 }; assert!(hash(&person1) == hash(&person1)); diff --git a/src/test/run-pass/deriving-show-2.rs b/src/test/run-pass/deriving-show-2.rs index 2b7438fd84540..1c80d63abb895 100644 --- a/src/test/run-pass/deriving-show-2.rs +++ b/src/test/run-pass/deriving-show-2.rs @@ -49,14 +49,14 @@ impl ToDebug for T { } pub fn main() { - assert_eq!(B::B1.to_show(), "B1".to_string()); - assert_eq!(B::B2.to_show(), "B2".to_string()); - assert_eq!(C::C1(3).to_show(), "C1(3)".to_string()); - assert_eq!(C::C2(B::B2).to_show(), "C2(B2)".to_string()); - assert_eq!(D::D1{ a: 2 }.to_show(), "D1 { a: 2 }".to_string()); - assert_eq!(E.to_show(), "E".to_string()); - assert_eq!(F(3).to_show(), "F(3)".to_string()); - assert_eq!(G(3, 4).to_show(), "G(3, 4)".to_string()); - assert_eq!(I{ a: 2, b: 4 }.to_show(), "I { a: 2, b: 4 }".to_string()); - assert_eq!(J(Custom).to_show(), "J(yay)".to_string()); + assert_eq!(B::B1.to_show(), "B1".to_owned()); + assert_eq!(B::B2.to_show(), "B2".to_owned()); + assert_eq!(C::C1(3).to_show(), "C1(3)".to_owned()); + assert_eq!(C::C2(B::B2).to_show(), "C2(B2)".to_owned()); + assert_eq!(D::D1{ a: 2 }.to_show(), "D1 { a: 2 }".to_owned()); + assert_eq!(E.to_show(), "E".to_owned()); + assert_eq!(F(3).to_show(), "F(3)".to_owned()); + assert_eq!(G(3, 4).to_show(), "G(3, 4)".to_owned()); + assert_eq!(I{ a: 2, b: 4 }.to_show(), "I { a: 2, b: 4 }".to_owned()); + assert_eq!(J(Custom).to_show(), "J(yay)".to_owned()); } diff --git a/src/test/run-pass/deriving-via-extension-struct-tuple.rs b/src/test/run-pass/deriving-via-extension-struct-tuple.rs index f9e1ea4a62384..3e74fd78be118 100644 --- a/src/test/run-pass/deriving-via-extension-struct-tuple.rs +++ b/src/test/run-pass/deriving-via-extension-struct-tuple.rs @@ -12,9 +12,9 @@ struct Foo(isize, isize, String); pub fn main() { - let a1 = Foo(5, 6, "abc".to_string()); - let a2 = Foo(5, 6, "abc".to_string()); - let b = Foo(5, 7, "def".to_string()); + let a1 = Foo(5, 6, "abc".to_owned()); + let a2 = Foo(5, 6, "abc".to_owned()); + let b = Foo(5, 7, "def".to_owned()); assert!(a1 == a1); assert!(a2 == a1); diff --git a/src/test/run-pass/drop-on-ret.rs b/src/test/run-pass/drop-on-ret.rs index fc517fa592f52..4e188a80d7a8a 100644 --- a/src/test/run-pass/drop-on-ret.rs +++ b/src/test/run-pass/drop-on-ret.rs @@ -15,7 +15,7 @@ fn f() -> isize { if true { - let _s: String = "should not leak".to_string(); + let _s: String = "should not leak".to_owned(); return 1; } return 0; diff --git a/src/test/run-pass/drop-with-type-ascription-1.rs b/src/test/run-pass/drop-with-type-ascription-1.rs index 15f229dbca5d9..86a0bb9020950 100644 --- a/src/test/run-pass/drop-with-type-ascription-1.rs +++ b/src/test/run-pass/drop-with-type-ascription-1.rs @@ -10,7 +10,7 @@ fn main() { - let foo = "hello".to_string(); + let foo = "hello".to_owned(); let foo: Vec<&str> = foo.split_whitespace().collect(); let invalid_string = &foo[0]; assert_eq!(*invalid_string, "hello"); diff --git a/src/test/run-pass/enum-discrim-width-stuff.rs b/src/test/run-pass/enum-discrim-width-stuff.rs index 46238c4572080..d0593186de16c 100644 --- a/src/test/run-pass/enum-discrim-width-stuff.rs +++ b/src/test/run-pass/enum-discrim-width-stuff.rs @@ -22,8 +22,8 @@ macro_rules! check { assert_eq!(size_of::(), size_of::<$t>()); assert_eq!(E::V as $t, $v as $t); assert_eq!(C as $t, $v as $t); - assert_eq!(format!("{:?}", E::V), "V".to_string()); - assert_eq!(format!("{:?}", C), "V".to_string()); + assert_eq!(format!("{:?}", E::V), "V".to_owned()); + assert_eq!(format!("{:?}", C), "V".to_owned()); } } $m::check(); diff --git a/src/test/run-pass/enum-disr-val-pretty.rs b/src/test/run-pass/enum-disr-val-pretty.rs index cf66725178011..d003f9160c451 100644 --- a/src/test/run-pass/enum-disr-val-pretty.rs +++ b/src/test/run-pass/enum-disr-val-pretty.rs @@ -14,10 +14,10 @@ enum color { red = 1, green, blue, imaginary = -1, } pub fn main() { - test_color(color::red, 1, "red".to_string()); - test_color(color::green, 2, "green".to_string()); - test_color(color::blue, 3, "blue".to_string()); - test_color(color::imaginary, -1, "imaginary".to_string()); + test_color(color::red, 1, "red".to_owned()); + test_color(color::green, 2, "green".to_owned()); + test_color(color::blue, 3, "blue".to_owned()); + test_color(color::imaginary, -1, "imaginary".to_owned()); } fn test_color(color: color, val: isize, _name: String) { diff --git a/src/test/run-pass/enum-variants.rs b/src/test/run-pass/enum-variants.rs index 77e6141d5592d..d94196101214b 100644 --- a/src/test/run-pass/enum-variants.rs +++ b/src/test/run-pass/enum-variants.rs @@ -19,8 +19,8 @@ enum Animal { } pub fn main() { - let mut a: Animal = Animal::Dog("Cocoa".to_string(), 37.2); - a = Animal::Cat{ name: "Spotty".to_string(), weight: 2.7 }; + let mut a: Animal = Animal::Dog("Cocoa".to_owned(), 37.2); + a = Animal::Cat{ name: "Spotty".to_owned(), weight: 2.7 }; // permuting the fields should work too - let _c = Animal::Cat { weight: 3.1, name: "Spreckles".to_string() }; + let _c = Animal::Cat { weight: 3.1, name: "Spreckles".to_owned() }; } diff --git a/src/test/run-pass/estr-uniq.rs b/src/test/run-pass/estr-uniq.rs index 4dfb15418405d..29851470b5261 100644 --- a/src/test/run-pass/estr-uniq.rs +++ b/src/test/run-pass/estr-uniq.rs @@ -12,9 +12,9 @@ #![allow(dead_assignment)] pub fn main() { - let x : String = "hello".to_string(); - let _y : String = "there".to_string(); - let mut z = "thing".to_string(); + let x : String = "hello".to_owned(); + let _y : String = "there".to_owned(); + let mut z = "thing".to_owned(); z = x; assert_eq!(z.as_bytes()[0], ('h' as u8)); assert_eq!(z.as_bytes()[4], ('o' as u8)); diff --git a/src/test/run-pass/exec-env.rs b/src/test/run-pass/exec-env.rs index d17056e6d799d..fad3d5f7ee336 100644 --- a/src/test/run-pass/exec-env.rs +++ b/src/test/run-pass/exec-env.rs @@ -14,5 +14,5 @@ use std::env; pub fn main() { - assert_eq!(env::var("TEST_EXEC_ENV"), Ok("22".to_string())); + assert_eq!(env::var("TEST_EXEC_ENV"), Ok("22".to_owned())); } diff --git a/src/test/run-pass/explicit_self_xcrate_exe.rs b/src/test/run-pass/explicit_self_xcrate_exe.rs index eaaf92fbea9ce..bbac924d851b3 100644 --- a/src/test/run-pass/explicit_self_xcrate_exe.rs +++ b/src/test/run-pass/explicit_self_xcrate_exe.rs @@ -16,6 +16,6 @@ extern crate explicit_self_xcrate; use explicit_self_xcrate::{Foo, Bar}; pub fn main() { - let x = Bar { x: "hello".to_string() }; + let x = Bar { x: "hello".to_owned() }; x.f(); } diff --git a/src/test/run-pass/foreign-fn-linkname.rs b/src/test/run-pass/foreign-fn-linkname.rs index a9001a3cdcf6e..9f389c007de97 100644 --- a/src/test/run-pass/foreign-fn-linkname.rs +++ b/src/test/run-pass/foreign-fn-linkname.rs @@ -33,6 +33,6 @@ fn strlen(str: String) -> usize { } pub fn main() { - let len = strlen("Rust".to_string()); + let len = strlen("Rust".to_owned()); assert_eq!(len, 4); } diff --git a/src/test/run-pass/format-nan.rs b/src/test/run-pass/format-nan.rs index 9bbd8cdb11d88..6e6222fd46ae7 100644 --- a/src/test/run-pass/format-nan.rs +++ b/src/test/run-pass/format-nan.rs @@ -11,7 +11,7 @@ pub fn main() { use std::f64; - let x = "NaN".to_string(); + let x = "NaN".to_owned(); assert_eq!(format!("{}", f64::NAN), x); assert_eq!(format!("{:e}", f64::NAN), x); assert_eq!(format!("{:E}", f64::NAN), x); diff --git a/src/test/run-pass/format-no-std.rs b/src/test/run-pass/format-no-std.rs index 9204cdfd755b6..a8d23139cc1d0 100644 --- a/src/test/run-pass/format-no-std.rs +++ b/src/test/run-pass/format-no-std.rs @@ -18,21 +18,21 @@ extern crate std as other; #[macro_use] extern crate core; #[macro_use] extern crate collections; -use collections::string::ToString; +use other::borrow::ToOwned; #[start] fn start(_argc: isize, _argv: *const *const u8) -> isize { let s = format!("{}", 1_isize); - assert_eq!(s, "1".to_string()); + assert_eq!(s, "1".to_owned()); let s = format!("test"); - assert_eq!(s, "test".to_string()); + assert_eq!(s, "test".to_owned()); let s = format!("{test}", test=3_isize); - assert_eq!(s, "3".to_string()); + assert_eq!(s, "3".to_owned()); let s = format!("hello {}", "world"); - assert_eq!(s, "hello world".to_string()); + assert_eq!(s, "hello world".to_owned()); 0 } diff --git a/src/test/run-pass/format-ref-cell.rs b/src/test/run-pass/format-ref-cell.rs index 0f16dfa1e8f15..69cce3720479e 100644 --- a/src/test/run-pass/format-ref-cell.rs +++ b/src/test/run-pass/format-ref-cell.rs @@ -15,5 +15,5 @@ pub fn main() { let name = RefCell::new("rust"); let what = RefCell::new("rocks"); let msg = format!("{name} {}", &*what.borrow(), name=&*name.borrow()); - assert_eq!(msg, "rust rocks".to_string()); + assert_eq!(msg, "rust rocks".to_owned()); } diff --git a/src/test/run-pass/generic-tag-corruption.rs b/src/test/run-pass/generic-tag-corruption.rs index d61ae520ada89..962ed5a0bc03f 100644 --- a/src/test/run-pass/generic-tag-corruption.rs +++ b/src/test/run-pass/generic-tag-corruption.rs @@ -16,4 +16,4 @@ enum thing { some(K), } -pub fn main() { let _x = thing::some("hi".to_string()); } +pub fn main() { let _x = thing::some("hi".to_owned()); } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 4dae1131c6d91..7d9a249af018f 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -18,7 +18,7 @@ */ pub fn map(filename: String, mut emit: map_reduce::putter) { - emit(filename, "1".to_string()); + emit(filename, "1".to_owned()); } mod map_reduce { @@ -97,5 +97,5 @@ mod map_reduce { pub fn main() { map_reduce::map_reduce( - vec!("../src/test/run-pass/hashmap-memory.rs".to_string())); + vec!("../src/test/run-pass/hashmap-memory.rs".to_owned())); } diff --git a/src/test/run-pass/html-literals.rs b/src/test/run-pass/html-literals.rs index 23970af957655..cb12fa703b16e 100644 --- a/src/test/run-pass/html-literals.rs +++ b/src/test/run-pass/html-literals.rs @@ -66,7 +66,7 @@ macro_rules! parse_node { ) => ( parse_node!( [$(: $tags ($(:$tag_nodes),*))*]; - [$(:$nodes,)* :text(".".to_string())]; + [$(:$nodes,)* :text(".".to_owned())]; $($rest)* ) ); diff --git a/src/test/run-pass/if-let.rs b/src/test/run-pass/if-let.rs index 13134abd8fdd9..ecad7cee45aab 100644 --- a/src/test/run-pass/if-let.rs +++ b/src/test/run-pass/if-let.rs @@ -45,7 +45,7 @@ pub fn main() { Three(String, isize) } - let foo = Foo::Three("three".to_string(), 42); + let foo = Foo::Three("three".to_owned(), 42); if let Foo::One = foo { panic!("bad pattern match"); } else if let Foo::Two(_x) = foo { diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index 240b6286c8cfc..b7319c8d7d670 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_string()), "a"); + t!(format!("{}", "a".to_owned()), "a"); t!(format!("{}", false), "false"); t!(format!("{}", 'a'), "a"); @@ -70,7 +70,7 @@ pub fn main() { t!(format!("{:x}", 10_usize), "a"); t!(format!("{:X}", 10_usize), "A"); t!(format!("{}", "foo"), "foo"); - t!(format!("{}", "foo".to_string()), "foo"); + t!(format!("{}", "foo".to_owned()), "foo"); if cfg!(target_pointer_width = "32") { t!(format!("{:#p}", 0x1234 as *const isize), "0x00001234"); t!(format!("{:#p}", 0x1234 as *mut isize), "0x00001234"); @@ -244,5 +244,5 @@ fn test_order() { } assert_eq!(format!("{} {} {a} {b} {} {c}", foo(), foo(), foo(), a=foo(), b=foo(), c=foo()), - "1 2 4 5 3 6".to_string()); + "1 2 4 5 3 6".to_owned()); } 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 22369c77ed33f..528f31a28af85 100644 --- a/src/test/run-pass/inferred-suffix-in-pattern-range.rs +++ b/src/test/run-pass/inferred-suffix-in-pattern-range.rs @@ -12,22 +12,22 @@ pub fn main() { let x = 2; let x_message = match x { - 0 ... 1 => { "not many".to_string() } - _ => { "lots".to_string() } + 0 ... 1 => { "not many".to_owned() } + _ => { "lots".to_owned() } }; - assert_eq!(x_message, "lots".to_string()); + assert_eq!(x_message, "lots".to_owned()); let y = 2; let y_message = match y { - 0 ... 1 => { "not many".to_string() } - _ => { "lots".to_string() } + 0 ... 1 => { "not many".to_owned() } + _ => { "lots".to_owned() } }; - assert_eq!(y_message, "lots".to_string()); + assert_eq!(y_message, "lots".to_owned()); let z = 1u64; let z_message = match z { - 0 ... 1 => { "not many".to_string() } - _ => { "lots".to_string() } + 0 ... 1 => { "not many".to_owned() } + _ => { "lots".to_owned() } }; - assert_eq!(z_message, "not many".to_string()); + assert_eq!(z_message, "not many".to_owned()); } diff --git a/src/test/run-pass/issue-1257.rs b/src/test/run-pass/issue-1257.rs index 44ebe362c729d..42ac78eca9380 100644 --- a/src/test/run-pass/issue-1257.rs +++ b/src/test/run-pass/issue-1257.rs @@ -11,10 +11,10 @@ // pretty-expanded FIXME #23616 pub fn main () { - let mut line = "".to_string(); + let mut line = "".to_owned(); let mut i = 0; - while line != "exit".to_string() { - line = if i == 9 { "exit".to_string() } else { "notexit".to_string() }; + while line != "exit".to_owned() { + line = if i == 9 { "exit".to_owned() } else { "notexit".to_owned() }; i += 1; } } diff --git a/src/test/run-pass/issue-13434.rs b/src/test/run-pass/issue-13434.rs index 5d7a84d80d4c3..617c98912c400 100644 --- a/src/test/run-pass/issue-13434.rs +++ b/src/test/run-pass/issue-13434.rs @@ -26,5 +26,5 @@ fn do_stuff(r: R) -> String { } pub fn main() { - assert_eq!("MyStruct".to_string(), do_stuff(|s: MyStruct| format!("{:?}", s))); + assert_eq!("MyStruct".to_owned(), do_stuff(|s: MyStruct| format!("{:?}", s))); } diff --git a/src/test/run-pass/issue-15129.rs b/src/test/run-pass/issue-15129.rs index 9bcfa6ea40a4e..2d5cbedfdc765 100644 --- a/src/test/run-pass/issue-15129.rs +++ b/src/test/run-pass/issue-15129.rs @@ -29,6 +29,6 @@ fn foo(x: (T, V)) -> String { fn main() { - assert_eq!(foo((T::T1(()), V::V1(99))), "T1(()), V1(99)".to_string()); - assert_eq!(foo((T::T2(()), V::V2(true))), "T2(()), V2(true)".to_string()); + assert_eq!(foo((T::T1(()), V::V1(99))), "T1(()), V1(99)".to_owned()); + assert_eq!(foo((T::T2(()), V::V2(true))), "T2(()), V2(true)".to_owned()); } diff --git a/src/test/run-pass/issue-1701.rs b/src/test/run-pass/issue-1701.rs index 3a2e46c62b079..15d66a52bd644 100644 --- a/src/test/run-pass/issue-1701.rs +++ b/src/test/run-pass/issue-1701.rs @@ -17,16 +17,16 @@ enum animal { cat(pattern), dog(breed), rabbit(name, ear_kind), tiger } fn noise(a: animal) -> Option { match a { - animal::cat(..) => { Some("meow".to_string()) } - animal::dog(..) => { Some("woof".to_string()) } + animal::cat(..) => { Some("meow".to_owned()) } + animal::dog(..) => { Some("woof".to_owned()) } animal::rabbit(..) => { None } - animal::tiger(..) => { Some("roar".to_string()) } + animal::tiger(..) => { Some("roar".to_owned()) } } } pub fn main() { - assert_eq!(noise(animal::cat(pattern::tabby)), Some("meow".to_string())); - assert_eq!(noise(animal::dog(breed::pug)), Some("woof".to_string())); - assert_eq!(noise(animal::rabbit("Hilbert".to_string(), ear_kind::upright)), None); - assert_eq!(noise(animal::tiger), Some("roar".to_string())); + assert_eq!(noise(animal::cat(pattern::tabby)), Some("meow".to_owned())); + assert_eq!(noise(animal::dog(breed::pug)), Some("woof".to_owned())); + assert_eq!(noise(animal::rabbit("Hilbert".to_owned(), ear_kind::upright)), None); + assert_eq!(noise(animal::tiger), Some("roar".to_owned())); } diff --git a/src/test/run-pass/issue-18352.rs b/src/test/run-pass/issue-18352.rs index cce6ba407a663..ebf7f50adc051 100644 --- a/src/test/run-pass/issue-18352.rs +++ b/src/test/run-pass/issue-18352.rs @@ -19,5 +19,5 @@ fn test(s: String) -> bool { } fn main() { - assert!(test("12345".to_string())); + assert!(test("12345".to_owned())); } diff --git a/src/test/run-pass/issue-19340-1.rs b/src/test/run-pass/issue-19340-1.rs index e553c244c8653..b0c09cf2d1662 100644 --- a/src/test/run-pass/issue-19340-1.rs +++ b/src/test/run-pass/issue-19340-1.rs @@ -17,7 +17,7 @@ extern crate issue_19340_1 as lib; use lib::Homura; fn main() { - let homura = Homura::Madoka { name: "Kaname".to_string() }; + let homura = Homura::Madoka { name: "Kaname".to_owned() }; match homura { Homura::Madoka { name } => (), diff --git a/src/test/run-pass/issue-19340-2.rs b/src/test/run-pass/issue-19340-2.rs index d7747201cbe46..7465f5c1b1d15 100644 --- a/src/test/run-pass/issue-19340-2.rs +++ b/src/test/run-pass/issue-19340-2.rs @@ -19,7 +19,7 @@ enum Homura { fn main() { let homura = Homura::Madoka { - name: "Akemi".to_string(), + name: "Akemi".to_owned(), age: 14, }; diff --git a/src/test/run-pass/issue-19367.rs b/src/test/run-pass/issue-19367.rs index d5bb6ebb7de1f..a3c56004ffadd 100644 --- a/src/test/run-pass/issue-19367.rs +++ b/src/test/run-pass/issue-19367.rs @@ -16,10 +16,10 @@ struct S { // on field of struct or tuple which we reassign in the match body. fn main() { - let mut a = (0, Some("right".to_string())); + let mut a = (0, Some("right".to_owned())); let b = match a.1 { Some(v) => { - a.1 = Some("wrong".to_string()); + a.1 = Some("wrong".to_owned()); v } None => String::new() @@ -28,10 +28,10 @@ fn main() { assert_eq!(b, "right"); - let mut s = S{ o: Some("right".to_string()) }; + let mut s = S{ o: Some("right".to_owned()) }; let b = match s.o { Some(v) => { - s.o = Some("wrong".to_string()); + s.o = Some("wrong".to_owned()); v } None => String::new(), diff --git a/src/test/run-pass/issue-1974.rs b/src/test/run-pass/issue-1974.rs index 7b33b4e7a4f39..25f988a5e9e81 100644 --- a/src/test/run-pass/issue-1974.rs +++ b/src/test/run-pass/issue-1974.rs @@ -13,8 +13,8 @@ // pretty-expanded FIXME #23616 pub fn main() { - let s = "hej".to_string(); - while s != "".to_string() { + let s = "hej".to_owned(); + while s != "".to_owned() { return; } } diff --git a/src/test/run-pass/issue-2631-b.rs b/src/test/run-pass/issue-2631-b.rs index 7413ebd350460..0604af93b0955 100644 --- a/src/test/run-pass/issue-2631-b.rs +++ b/src/test/run-pass/issue-2631-b.rs @@ -21,8 +21,8 @@ use std::collections::HashMap; use std::rc::Rc; pub fn main() { - let v = vec!(Rc::new("hi".to_string())); + let v = vec!(Rc::new("hi".to_owned())); let mut m: req::header_map = HashMap::new(); - m.insert("METHOD".to_string(), Rc::new(RefCell::new(v))); + m.insert("METHOD".to_owned(), Rc::new(RefCell::new(v))); request::(&m); } diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs index 18cd9a87e6b05..062cb0dc6a60e 100644 --- a/src/test/run-pass/issue-2734.rs +++ b/src/test/run-pass/issue-2734.rs @@ -23,7 +23,7 @@ fn perform_hax(x: Box) -> Box { } fn deadcode() { - perform_hax(box "deadcode".to_string()); + perform_hax(box "deadcode".to_owned()); } pub fn main() { diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs index cd6c6a59e2a6c..4ec187ecce7e7 100644 --- a/src/test/run-pass/issue-2735.rs +++ b/src/test/run-pass/issue-2735.rs @@ -23,7 +23,7 @@ fn perform_hax(x: Box) -> Box { } fn deadcode() { - perform_hax(box "deadcode".to_string()); + perform_hax(box "deadcode".to_owned()); } pub fn main() { diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index a2b4e218a079b..034804c0b013e 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -44,15 +44,15 @@ fn add_interface(_store: isize, managed_ip: String, data: json::Json) -> (String match &data { &Json::Object(ref interface) => { let name = lookup(interface.clone(), - "ifDescr".to_string(), - "".to_string()); + "ifDescr".to_owned(), + "".to_owned()); let label = format!("{}-{}", managed_ip, name); (label, object::bool_value(false)) } _ => { println!("Expected dict for {} interfaces, found {}", managed_ip, data); - ("gnos:missing-interface".to_string(), object::bool_value(true)) + ("gnos:missing-interface".to_owned(), object::bool_value(true)) } } } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index 2c45d664d894e..fae1d5cf7dd8e 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -29,14 +29,14 @@ enum square { impl fmt::Debug for square { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", match *self { - 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() } + 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() } }) } } diff --git a/src/test/run-pass/issue-3389.rs b/src/test/run-pass/issue-3389.rs index 26558bdd30c3b..314f13e3a64ba 100644 --- a/src/test/run-pass/issue-3389.rs +++ b/src/test/run-pass/issue-3389.rs @@ -25,8 +25,8 @@ pub fn main() { content: Vec::new(), children: Vec::new() }; - let v = vec!("123".to_string(), "abc".to_string()); - node.content = vec!("123".to_string(), "abc".to_string()); + let v = vec!("123".to_owned(), "abc".to_owned()); + node.content = vec!("123".to_owned(), "abc".to_owned()); print_str_vector(v); print_str_vector(node.content.clone()); diff --git a/src/test/run-pass/issue-3424.rs b/src/test/run-pass/issue-3424.rs index 74e58f31e23e2..92dbdc7ae5813 100644 --- a/src/test/run-pass/issue-3424.rs +++ b/src/test/run-pass/issue-3424.rs @@ -17,7 +17,7 @@ type rsrc_loader = Box Result>; fn tester() { let mut loader: rsrc_loader = Box::new(move |_path| { - Ok("more blah".to_string()) + Ok("more blah".to_owned()) }); let path = Path; diff --git a/src/test/run-pass/issue-3556.rs b/src/test/run-pass/issue-3556.rs index e6b577ada0c86..f3c58c17101a1 100644 --- a/src/test/run-pass/issue-3556.rs +++ b/src/test/run-pass/issue-3556.rs @@ -32,13 +32,13 @@ fn check_strs(actual: &str, expected: &str) -> bool pub fn main() { - let t = Token::Text("foo".to_string()); - let u = Token::Section(vec!["alpha".to_string()], + let t = Token::Text("foo".to_owned()); + let u = Token::Section(vec!["alpha".to_owned()], true, vec![t], - "foo".to_string(), - "foo".to_string(), "foo".to_string(), "foo".to_string(), - "foo".to_string()); + "foo".to_owned(), + "foo".to_owned(), "foo".to_owned(), "foo".to_owned(), + "foo".to_owned()); let v = format!("{:?}", u); // this is the line that causes the seg fault assert!(!v.is_empty()); } diff --git a/src/test/run-pass/issue-3559.rs b/src/test/run-pass/issue-3559.rs index c2ea24ac6ba99..b58f7bf775e2b 100644 --- a/src/test/run-pass/issue-3559.rs +++ b/src/test/run-pass/issue-3559.rs @@ -24,8 +24,8 @@ fn check_strs(actual: &str, expected: &str) -> bool { pub fn main() { let mut table = HashMap::new(); - table.insert("one".to_string(), 1); - table.insert("two".to_string(), 2); + table.insert("one".to_owned(), 1); + table.insert("two".to_owned(), 2); assert!(check_strs(&format!("{:?}", table), "{\"one\": 1, \"two\": 2}") || check_strs(&format!("{:?}", table), "{\"two\": 2, \"one\": 1}")); } diff --git a/src/test/run-pass/issue-3935.rs b/src/test/run-pass/issue-3935.rs index 45ff20fc0a9c3..fdc0d4dfdcbeb 100644 --- a/src/test/run-pass/issue-3935.rs +++ b/src/test/run-pass/issue-3935.rs @@ -15,8 +15,8 @@ struct Bike { } pub fn main() { - let town_bike = Bike { name: "schwinn".to_string() }; - let my_bike = Bike { name: "surly".to_string() }; + let town_bike = Bike { name: "schwinn".to_owned() }; + let my_bike = Bike { name: "surly".to_owned() }; assert!(town_bike != my_bike); } diff --git a/src/test/run-pass/issue-4241.rs b/src/test/run-pass/issue-4241.rs index ab75c2064a403..13f0b3b55b79d 100644 --- a/src/test/run-pass/issue-4241.rs +++ b/src/test/run-pass/issue-4241.rs @@ -97,12 +97,12 @@ fn parse_response(io: @io::Reader) -> Result { } fn cmd_to_string(cmd: Vec) -> String { - let mut res = "*".to_string(); + let mut res = "*".to_owned(); res.push_str(cmd.len().to_string()); res.push_str("\r\n"); for s in &cmd { - res.push_str(["$".to_string(), s.len().to_string(), "\r\n".to_string(), - (*s).clone(), "\r\n".to_string()].concat() ); + res.push_str(["$".to_owned(), s.len().to_string(), "\r\n".to_owned(), + (*s).clone(), "\r\n".to_owned()].concat() ); } res } @@ -117,7 +117,7 @@ fn query(cmd: Vec, sb: TcpSocketBuf) -> Result { fn query2(cmd: Vec) -> Result { let _cmd = cmd_to_string(cmd); - io::with_str_reader("$3\r\nXXX\r\n".to_string())(|sb| { + io::with_str_reader("$3\r\nXXX\r\n".to_owned())(|sb| { let res = parse_response(@sb as @io::Reader); println!("{}", res); res diff --git a/src/test/run-pass/issue-4541.rs b/src/test/run-pass/issue-4541.rs index 1f090d8b622e0..5a6797e5459cd 100644 --- a/src/test/run-pass/issue-4541.rs +++ b/src/test/run-pass/issue-4541.rs @@ -22,7 +22,7 @@ fn parse_args() -> String { n += 1; } - return "".to_string() + return "".to_owned() } pub fn main() { diff --git a/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs b/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs index 90900ca46ce01..edf5f90562746 100644 --- a/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs +++ b/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs @@ -25,7 +25,7 @@ struct Thing { } impl Thing { - fn new() -> Thing { Thing { name: "dummy".to_string() } } + fn new() -> Thing { Thing { name: "dummy".to_owned() } } } impl Debuggable for Thing { diff --git a/src/test/run-pass/issue-5353.rs b/src/test/run-pass/issue-5353.rs index 34ef63572ae1e..5f6c1163e2921 100644 --- a/src/test/run-pass/issue-5353.rs +++ b/src/test/run-pass/issue-5353.rs @@ -17,9 +17,9 @@ fn gl_err_str(err: u32) -> String { match err { - INVALID_ENUM => { "Invalid enum".to_string() }, - INVALID_VALUE => { "Invalid value".to_string() }, - _ => { "Unknown error".to_string() } + INVALID_ENUM => { "Invalid enum".to_owned() }, + INVALID_VALUE => { "Invalid value".to_owned() }, + _ => { "Unknown error".to_owned() } } } diff --git a/src/test/run-pass/issue-5550.rs b/src/test/run-pass/issue-5550.rs index 91741f938a5a0..8188e5299b720 100644 --- a/src/test/run-pass/issue-5550.rs +++ b/src/test/run-pass/issue-5550.rs @@ -13,7 +13,7 @@ #![allow(dead_assignment)] pub fn main() { - let s: String = "foobar".to_string(); + let s: String = "foobar".to_owned(); let mut t: &str = &s; t = &t[0..3]; // for master: str::view(t, 0, 3) maybe } diff --git a/src/test/run-pass/issue-5666.rs b/src/test/run-pass/issue-5666.rs index e28a929d52723..a38572cd1e916 100644 --- a/src/test/run-pass/issue-5666.rs +++ b/src/test/run-pass/issue-5666.rs @@ -27,8 +27,8 @@ impl Barks for Dog { pub fn main() { - let snoopy = box Dog{name: "snoopy".to_string()}; - let bubbles = box Dog{name: "bubbles".to_string()}; + let snoopy = box Dog{name: "snoopy".to_owned()}; + let bubbles = box Dog{name: "bubbles".to_owned()}; let barker = [snoopy as Box, bubbles as Box]; for pup in &barker { diff --git a/src/test/run-pass/issue-8898.rs b/src/test/run-pass/issue-8898.rs index 065cef2c60d7d..a29c201dc41fe 100644 --- a/src/test/run-pass/issue-8898.rs +++ b/src/test/run-pass/issue-8898.rs @@ -19,9 +19,9 @@ pub fn main() { let x = [(), ()]; let slice = &x[..1]; - assert_repr_eq(&abc[..], "[1, 2, 3]".to_string()); - assert_repr_eq(&tf[..], "[true, false]".to_string()); - assert_repr_eq(&x[..], "[(), ()]".to_string()); - assert_repr_eq(slice, "[()]".to_string()); - assert_repr_eq(&x[..], "[(), ()]".to_string()); + assert_repr_eq(&abc[..], "[1, 2, 3]".to_owned()); + assert_repr_eq(&tf[..], "[true, false]".to_owned()); + assert_repr_eq(&x[..], "[(), ()]".to_owned()); + assert_repr_eq(slice, "[()]".to_owned()); + assert_repr_eq(&x[..], "[(), ()]".to_owned()); } diff --git a/src/test/run-pass/issue-9047.rs b/src/test/run-pass/issue-9047.rs index aa3e601c3a205..331317f846e62 100644 --- a/src/test/run-pass/issue-9047.rs +++ b/src/test/run-pass/issue-9047.rs @@ -13,7 +13,7 @@ fn decode() -> String { let mut ch_start: usize; break 'outer; } - "".to_string() + "".to_owned() } pub fn main() { diff --git a/src/test/run-pass/issue-9259.rs b/src/test/run-pass/issue-9259.rs index 996548de81738..f03afb2e5470b 100644 --- a/src/test/run-pass/issue-9259.rs +++ b/src/test/run-pass/issue-9259.rs @@ -15,9 +15,9 @@ struct A<'a> { } pub fn main() { - let b: &[String] = &["foo".to_string()]; + let b: &[String] = &["foo".to_owned()]; let a = A { - a: &["test".to_string()], + a: &["test".to_owned()], b: Some(b), }; assert_eq!(a.b.as_ref().unwrap()[0], "foo"); diff --git a/src/test/run-pass/issue-9394-inherited-trait-calls.rs b/src/test/run-pass/issue-9394-inherited-trait-calls.rs index 7d2c435b38429..7c984131bbaad 100644 --- a/src/test/run-pass/issue-9394-inherited-trait-calls.rs +++ b/src/test/run-pass/issue-9394-inherited-trait-calls.rs @@ -13,7 +13,7 @@ trait Base: Base2 + Base3{ fn foo(&self) -> String; fn foo1(&self) -> String; fn foo2(&self) -> String{ - "base foo2".to_string() + "base foo2".to_owned() } } @@ -33,39 +33,39 @@ struct X; impl Base for X { fn foo(&self) -> String{ - "base foo".to_string() + "base foo".to_owned() } fn foo1(&self) -> String{ - "base foo1".to_string() + "base foo1".to_owned() } } impl Base2 for X { fn baz(&self) -> String{ - "base2 baz".to_string() + "base2 baz".to_owned() } } impl Base3 for X { fn root(&self) -> String{ - "base3 root".to_string() + "base3 root".to_owned() } } impl Super for X { fn bar(&self) -> String{ - "super bar".to_string() + "super bar".to_owned() } } pub fn main() { let n = X; let s = &n as &Super; - assert_eq!(s.bar(),"super bar".to_string()); - assert_eq!(s.foo(),"base foo".to_string()); - assert_eq!(s.foo1(),"base foo1".to_string()); - assert_eq!(s.foo2(),"base foo2".to_string()); - assert_eq!(s.baz(),"base2 baz".to_string()); - assert_eq!(s.root(),"base3 root".to_string()); + assert_eq!(s.bar(),"super bar".to_owned()); + assert_eq!(s.foo(),"base foo".to_owned()); + assert_eq!(s.foo1(),"base foo1".to_owned()); + assert_eq!(s.foo2(),"base foo2".to_owned()); + assert_eq!(s.baz(),"base2 baz".to_owned()); + assert_eq!(s.root(),"base3 root".to_owned()); } diff --git a/src/test/run-pass/issue-9446.rs b/src/test/run-pass/issue-9446.rs index a6adb1d369e40..e4aba92c8e68d 100644 --- a/src/test/run-pass/issue-9446.rs +++ b/src/test/run-pass/issue-9446.rs @@ -28,12 +28,12 @@ impl Drop for Wrapper { pub fn main() { { // This runs without complaint. - let x = Wrapper::new("Bob".to_string()); + let x = Wrapper::new("Bob".to_owned()); x.say_hi(); } { // This fails to compile, circa 0.8-89-gc635fba. // error: internal compiler error: drop_ty_immediate: non-box ty - Wrapper::new("Bob".to_string()).say_hi(); + Wrapper::new("Bob".to_owned()).say_hi(); } } diff --git a/src/test/run-pass/istr.rs b/src/test/run-pass/istr.rs index 6cc8751c554ca..52c03cdf5bc89 100644 --- a/src/test/run-pass/istr.rs +++ b/src/test/run-pass/istr.rs @@ -13,26 +13,26 @@ use std::string::String; fn test_stack_assign() { - let s: String = "a".to_string(); + let s: String = "a".to_owned(); println!("{}", s.clone()); - let t: String = "a".to_string(); + let t: String = "a".to_owned(); assert!(s == t); - let u: String = "b".to_string(); + let u: String = "b".to_owned(); assert!((s != u)); } -fn test_heap_lit() { "a big string".to_string(); } +fn test_heap_lit() { "a big string".to_owned(); } fn test_heap_assign() { - let s: String = "a big ol' string".to_string(); - let t: String = "a big ol' string".to_string(); + let s: String = "a big ol' string".to_owned(); + let t: String = "a big ol' string".to_owned(); assert!(s == t); - let u: String = "a bad ol' string".to_string(); + let u: String = "a bad ol' string".to_owned(); assert!((s != u)); } fn test_heap_log() { - let s = "a big ol' string".to_string(); + let s = "a big ol' string".to_owned(); println!("{}", s); } diff --git a/src/test/run-pass/linear-for-loop.rs b/src/test/run-pass/linear-for-loop.rs index 80bd15578d115..14c320ee3a3c1 100644 --- a/src/test/run-pass/linear-for-loop.rs +++ b/src/test/run-pass/linear-for-loop.rs @@ -16,7 +16,7 @@ pub fn main() { for i in &x { println!("{}", *i); y += *i; } println!("{}", y); assert_eq!(y, 6); - let s = "hello there".to_string(); + let s = "hello there".to_owned(); let mut i: isize = 0; for c in s.bytes() { if i == 0 { assert!((c == 'h' as u8)); } diff --git a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs index 1991e2b178d51..57634d32dca95 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs @@ -20,13 +20,13 @@ fn check_log(exp: String, v: T) { pub fn main() { let mut x = Some(foo::a(22)); - let exp = "Some(a(22))".to_string(); + let exp = "Some(a(22))".to_owned(); let act = format!("{:?}", x); assert_eq!(act, exp); check_log(exp, x); x = None; - let exp = "None".to_string(); + let exp = "None".to_owned(); let act = format!("{:?}", x); assert_eq!(act, exp); check_log(exp, x); diff --git a/src/test/run-pass/log-knows-the-names-of-variants.rs b/src/test/run-pass/log-knows-the-names-of-variants.rs index e8852377957f8..3a0397087ec68 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants.rs @@ -21,7 +21,7 @@ enum bar { } pub fn main() { - assert_eq!("a(22)".to_string(), format!("{:?}", foo::a(22))); - assert_eq!("c".to_string(), format!("{:?}", foo::c)); - assert_eq!("d".to_string(), format!("{:?}", bar::d)); + assert_eq!("a(22)".to_owned(), format!("{:?}", foo::a(22))); + assert_eq!("c".to_owned(), format!("{:?}", foo::c)); + assert_eq!("d".to_owned(), format!("{:?}", bar::d)); } diff --git a/src/test/run-pass/match-borrowed_str.rs b/src/test/run-pass/match-borrowed_str.rs index b027e62494c23..1356f9c685eae 100644 --- a/src/test/run-pass/match-borrowed_str.rs +++ b/src/test/run-pass/match-borrowed_str.rs @@ -13,47 +13,47 @@ fn f1(ref_string: &str) -> String { match ref_string { - "a" => "found a".to_string(), - "b" => "found b".to_string(), - _ => "not found".to_string() + "a" => "found a".to_owned(), + "b" => "found b".to_owned(), + _ => "not found".to_owned() } } fn f2(ref_string: &str) -> String { match ref_string { - "a" => "found a".to_string(), - "b" => "found b".to_string(), + "a" => "found a".to_owned(), + "b" => "found b".to_owned(), s => format!("not found ({})", s) } } fn g1(ref_1: &str, ref_2: &str) -> String { match (ref_1, ref_2) { - ("a", "b") => "found a,b".to_string(), - ("b", "c") => "found b,c".to_string(), - _ => "not found".to_string() + ("a", "b") => "found a,b".to_owned(), + ("b", "c") => "found b,c".to_owned(), + _ => "not found".to_owned() } } fn g2(ref_1: &str, ref_2: &str) -> String { match (ref_1, ref_2) { - ("a", "b") => "found a,b".to_string(), - ("b", "c") => "found b,c".to_string(), + ("a", "b") => "found a,b".to_owned(), + ("b", "c") => "found b,c".to_owned(), (s1, s2) => format!("not found ({}, {})", s1, s2) } } pub fn main() { - assert_eq!(f1("b"), "found b".to_string()); - assert_eq!(f1("c"), "not found".to_string()); - assert_eq!(f1("d"), "not found".to_string()); - assert_eq!(f2("b"), "found b".to_string()); - assert_eq!(f2("c"), "not found (c)".to_string()); - assert_eq!(f2("d"), "not found (d)".to_string()); - assert_eq!(g1("b", "c"), "found b,c".to_string()); - assert_eq!(g1("c", "d"), "not found".to_string()); - assert_eq!(g1("d", "e"), "not found".to_string()); - assert_eq!(g2("b", "c"), "found b,c".to_string()); - assert_eq!(g2("c", "d"), "not found (c, d)".to_string()); - assert_eq!(g2("d", "e"), "not found (d, e)".to_string()); + assert_eq!(f1("b"), "found b".to_owned()); + assert_eq!(f1("c"), "not found".to_owned()); + assert_eq!(f1("d"), "not found".to_owned()); + assert_eq!(f2("b"), "found b".to_owned()); + assert_eq!(f2("c"), "not found (c)".to_owned()); + assert_eq!(f2("d"), "not found (d)".to_owned()); + assert_eq!(g1("b", "c"), "found b,c".to_owned()); + assert_eq!(g1("c", "d"), "not found".to_owned()); + assert_eq!(g1("d", "e"), "not found".to_owned()); + assert_eq!(g2("b", "c"), "found b,c".to_owned()); + assert_eq!(g2("c", "d"), "not found (c, d)".to_owned()); + assert_eq!(g2("d", "e"), "not found (d, e)".to_owned()); } diff --git a/src/test/run-pass/match-pipe-binding.rs b/src/test/run-pass/match-pipe-binding.rs index bda90d3aaecb4..3cd8a6ae2da35 100644 --- a/src/test/run-pass/match-pipe-binding.rs +++ b/src/test/run-pass/match-pipe-binding.rs @@ -11,10 +11,10 @@ fn test1() { // from issue 6338 - match ((1, "a".to_string()), (2, "b".to_string())) { + match ((1, "a".to_owned()), (2, "b".to_owned())) { ((1, a), (2, b)) | ((2, b), (1, a)) => { - assert_eq!(a, "a".to_string()); - assert_eq!(b, "b".to_string()); + assert_eq!(a, "a".to_owned()); + assert_eq!(b, "b".to_owned()); }, _ => panic!(), } diff --git a/src/test/run-pass/match-str.rs b/src/test/run-pass/match-str.rs index e6def65e53a6f..2549a6940e545 100644 --- a/src/test/run-pass/match-str.rs +++ b/src/test/run-pass/match-str.rs @@ -17,7 +17,7 @@ pub fn main() { enum t { tag1(String), tag2, } - match t::tag1("test".to_string()) { + match t::tag1("test".to_owned()) { t::tag2 => panic!(), t::tag1(ref s) if "test" != &**s => panic!(), t::tag1(ref s) if "test" == &**s => (), diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index e309fa14302ca..c67460850920e 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -43,13 +43,13 @@ fn transform(x: Option) -> Option { } pub fn main() { - assert_eq!(transform(Some(10)), Some("11".to_string())); + assert_eq!(transform(Some(10)), Some("11".to_owned())); assert_eq!(transform(None), None); - assert_eq!((vec!("hi".to_string())) + assert_eq!((vec!("hi".to_owned())) .bind(|x| vec!(x.clone(), format!("{}!", x)) ) .bind(|x| vec!(x.clone(), format!("{}?", x)) ), - ["hi".to_string(), - "hi?".to_string(), - "hi!".to_string(), - "hi!?".to_string()]); + ["hi".to_owned(), + "hi?".to_owned(), + "hi!".to_owned(), + "hi!?".to_owned()]); } diff --git a/src/test/run-pass/move-self.rs b/src/test/run-pass/move-self.rs index c69cd17864a54..ddebf9e6f6705 100644 --- a/src/test/run-pass/move-self.rs +++ b/src/test/run-pass/move-self.rs @@ -23,6 +23,6 @@ impl S { } pub fn main() { - let x = S { x: "Hello!".to_string() }; + let x = S { x: "Hello!".to_owned() }; x.foo(); } 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 c7ef9776367bd..267c132387eb6 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 @@ -13,7 +13,7 @@ use std::thread; pub fn main() { - let x = "Hello world!".to_string(); + let x = "Hello world!".to_owned(); thread::spawn(move|| { println!("{}", x); }).join(); diff --git a/src/test/run-pass/nullable-pointer-iotareduction.rs b/src/test/run-pass/nullable-pointer-iotareduction.rs index ced2b24f36cfe..487d922ea0e6e 100644 --- a/src/test/run-pass/nullable-pointer-iotareduction.rs +++ b/src/test/run-pass/nullable-pointer-iotareduction.rs @@ -77,7 +77,7 @@ macro_rules! check_type { pub fn main() { check_type!(&17, &isize); check_type!(box 18, Box); - check_type!("foo".to_string(), String); + check_type!("foo".to_owned(), String); check_type!(vec!(20, 22), Vec ); let mint: usize = unsafe { mem::transmute(main) }; check_type!(main, fn(), |pthing| { diff --git a/src/test/run-pass/nullable-pointer-opt-closures.rs b/src/test/run-pass/nullable-pointer-opt-closures.rs index ac5634e6cdd16..1ac9013e3bb59 100644 --- a/src/test/run-pass/nullable-pointer-opt-closures.rs +++ b/src/test/run-pass/nullable-pointer-opt-closures.rs @@ -28,7 +28,7 @@ pub fn main() { assert_eq!(mem::size_of_val(&b), mem::size_of::>()); // By Value Capture - Transitive case - let a = "Hello".to_string(); // String -> Vec -> Unique -> NonZero + let a = "Hello".to_owned(); // String -> Vec -> Unique -> NonZero let b = Some(move || println!("{}", a)); // We captured `a` by value and since down the chain it contains // a `NonZero` field, we can use it as the discriminant. diff --git a/src/test/run-pass/overloaded-autoderef.rs b/src/test/run-pass/overloaded-autoderef.rs index ed3ddb43b2617..9eb8396fccddf 100644 --- a/src/test/run-pass/overloaded-autoderef.rs +++ b/src/test/run-pass/overloaded-autoderef.rs @@ -31,7 +31,7 @@ pub fn main() { *i.borrow_mut() = 5; assert_eq!((i_value, *i.borrow()), (2, 5)); - let s = Rc::new("foo".to_string()); + let s = Rc::new("foo".to_owned()); assert_eq!(&**s, "foo"); let mut_s = Rc::new(RefCell::new(String::from("foo"))); diff --git a/src/test/run-pass/overloaded-deref.rs b/src/test/run-pass/overloaded-deref.rs index 3590b7c616cff..51287f039f4f3 100644 --- a/src/test/run-pass/overloaded-deref.rs +++ b/src/test/run-pass/overloaded-deref.rs @@ -30,8 +30,8 @@ pub fn main() { *(*i).borrow_mut() = 5; assert_eq!((i_value, *(*i).borrow()), (2, 5)); - let s = Rc::new("foo".to_string()); - assert_eq!(*s, "foo".to_string()); + let s = Rc::new("foo".to_owned()); + assert_eq!(*s, "foo".to_owned()); assert_eq!((*s), "foo"); let mut_s = Rc::new(RefCell::new(String::from("foo"))); diff --git a/src/test/run-pass/overloaded-index-assoc-list.rs b/src/test/run-pass/overloaded-index-assoc-list.rs index 455099f1eba8f..654d953753389 100644 --- a/src/test/run-pass/overloaded-index-assoc-list.rs +++ b/src/test/run-pass/overloaded-index-assoc-list.rs @@ -45,8 +45,8 @@ impl<'a, K: PartialEq + std::fmt::Debug, V:Clone> Index<&'a K> for AssociationLi } pub fn main() { - let foo = "foo".to_string(); - let bar = "bar".to_string(); + let foo = "foo".to_owned(); + let bar = "bar".to_owned(); let mut list = AssociationList {pairs: Vec::new()}; list.push(foo.clone(), 22); diff --git a/src/test/run-pass/process-spawn-with-unicode-params.rs b/src/test/run-pass/process-spawn-with-unicode-params.rs index a155ee396b614..316190392c729 100644 --- a/src/test/run-pass/process-spawn-with-unicode-params.rs +++ b/src/test/run-pass/process-spawn-with-unicode-params.rs @@ -42,7 +42,7 @@ fn main() { // parameters sent to child / expected to be received from parent let arg = blah; let cwd = my_dir.join(&child_dir); - let env = ("RUST_TEST_PROC_SPAWN_UNICODE".to_string(), blah.to_string()); + let env = ("RUST_TEST_PROC_SPAWN_UNICODE".to_owned(), blah.to_string()); // am I the parent or the child? if my_args.len() == 1 { // parent diff --git a/src/test/run-pass/rec-align-u32.rs b/src/test/run-pass/rec-align-u32.rs index e5d76c3e67abd..12ca4ad212b43 100644 --- a/src/test/run-pass/rec-align-u32.rs +++ b/src/test/run-pass/rec-align-u32.rs @@ -66,6 +66,6 @@ pub fn main() { // because `inner`s alignment was 4. assert_eq!(mem::size_of::(), m::size()); - assert_eq!(y, "Outer { c8: 22, t: Inner { c64: 44 } }".to_string()); + assert_eq!(y, "Outer { c8: 22, t: Inner { c64: 44 } }".to_owned()); } } diff --git a/src/test/run-pass/rec-align-u64.rs b/src/test/run-pass/rec-align-u64.rs index bae95bcb50f50..9d4825f322847 100644 --- a/src/test/run-pass/rec-align-u64.rs +++ b/src/test/run-pass/rec-align-u64.rs @@ -105,6 +105,6 @@ pub fn main() { // because `Inner`s alignment was 4. assert_eq!(mem::size_of::(), m::m::size()); - assert_eq!(y, "Outer { c8: 22, t: Inner { c64: 44 } }".to_string()); + assert_eq!(y, "Outer { c8: 22, t: Inner { c64: 44 } }".to_owned()); } } diff --git a/src/test/run-pass/rec-auto.rs b/src/test/run-pass/rec-auto.rs index 18431bc53794c..d23b7347d6f54 100644 --- a/src/test/run-pass/rec-auto.rs +++ b/src/test/run-pass/rec-auto.rs @@ -17,7 +17,7 @@ struct X { foo: String, bar: String } pub fn main() { - let x = X {foo: "hello".to_string(), bar: "world".to_string()}; + let x = X {foo: "hello".to_owned(), bar: "world".to_owned()}; println!("{}", x.foo.clone()); println!("{}", x.bar.clone()); } diff --git a/src/test/run-pass/reexported-static-methods-cross-crate.rs b/src/test/run-pass/reexported-static-methods-cross-crate.rs index 4d10503838446..1850c6fd27525 100644 --- a/src/test/run-pass/reexported-static-methods-cross-crate.rs +++ b/src/test/run-pass/reexported-static-methods-cross-crate.rs @@ -21,5 +21,5 @@ pub fn main() { assert_eq!(42_isize, Foo::foo()); assert_eq!(84_isize, Baz::bar()); assert!(Boz::boz(1)); - assert_eq!("bort()".to_string(), Bort::bort()); + assert_eq!("bort()".to_owned(), Bort::bort()); } diff --git a/src/test/run-pass/ret-bang.rs b/src/test/run-pass/ret-bang.rs index 7d4d021811227..9603c8e228858 100644 --- a/src/test/run-pass/ret-bang.rs +++ b/src/test/run-pass/ret-bang.rs @@ -15,7 +15,7 @@ fn my_err(s: String) -> ! { println!("{}", s); panic!(); } fn okay(i: usize) -> isize { if i == 3 { - my_err("I don't like three".to_string()); + my_err("I don't like three".to_owned()); } else { return 42; } diff --git a/src/test/run-pass/send_str_hashmap.rs b/src/test/run-pass/send_str_hashmap.rs index 2501ef94bea82..999855e5ab9c4 100644 --- a/src/test/run-pass/send_str_hashmap.rs +++ b/src/test/run-pass/send_str_hashmap.rs @@ -21,35 +21,35 @@ type SendStr = Cow<'static, str>; pub fn main() { let mut map: HashMap = HashMap::new(); assert!(map.insert("foo".into_cow(), 42).is_none()); - assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); + assert!(map.insert("foo".to_owned().into_cow(), 42).is_some()); assert!(map.insert("foo".into_cow(), 42).is_some()); - assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); + assert!(map.insert("foo".to_owned().into_cow(), 42).is_some()); assert!(map.insert("foo".into_cow(), 43).is_some()); - assert!(map.insert("foo".to_string().into_cow(), 44).is_some()); + assert!(map.insert("foo".to_owned().into_cow(), 44).is_some()); assert!(map.insert("foo".into_cow(), 45).is_some()); - assert!(map.insert("foo".to_string().into_cow(), 46).is_some()); + assert!(map.insert("foo".to_owned().into_cow(), 46).is_some()); let v = 46; - assert_eq!(map.get(&"foo".to_string().into_cow()), Some(&v)); + assert_eq!(map.get(&"foo".to_owned().into_cow()), Some(&v)); assert_eq!(map.get(&"foo".into_cow()), Some(&v)); let (a, b, c, d) = (50, 51, 52, 53); assert!(map.insert("abc".into_cow(), a).is_none()); - assert!(map.insert("bcd".to_string().into_cow(), b).is_none()); + assert!(map.insert("bcd".to_owned().into_cow(), b).is_none()); assert!(map.insert("cde".into_cow(), c).is_none()); - assert!(map.insert("def".to_string().into_cow(), d).is_none()); + assert!(map.insert("def".to_owned().into_cow(), d).is_none()); assert!(map.insert("abc".into_cow(), a).is_some()); - assert!(map.insert("bcd".to_string().into_cow(), b).is_some()); + assert!(map.insert("bcd".to_owned().into_cow(), b).is_some()); assert!(map.insert("cde".into_cow(), c).is_some()); - assert!(map.insert("def".to_string().into_cow(), d).is_some()); + assert!(map.insert("def".to_owned().into_cow(), d).is_some()); - assert!(map.insert("abc".to_string().into_cow(), a).is_some()); + assert!(map.insert("abc".to_owned().into_cow(), a).is_some()); assert!(map.insert("bcd".into_cow(), b).is_some()); - assert!(map.insert("cde".to_string().into_cow(), c).is_some()); + assert!(map.insert("cde".to_owned().into_cow(), c).is_some()); assert!(map.insert("def".into_cow(), d).is_some()); assert_eq!(map.get("abc"), Some(&a)); diff --git a/src/test/run-pass/send_str_treemap.rs b/src/test/run-pass/send_str_treemap.rs index 146f5253508c6..50d5c5eb44456 100644 --- a/src/test/run-pass/send_str_treemap.rs +++ b/src/test/run-pass/send_str_treemap.rs @@ -21,35 +21,35 @@ type SendStr = Cow<'static, str>; pub fn main() { let mut map: BTreeMap = BTreeMap::new(); assert!(map.insert("foo".into_cow(), 42).is_none()); - assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); + assert!(map.insert("foo".to_owned().into_cow(), 42).is_some()); assert!(map.insert("foo".into_cow(), 42).is_some()); - assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); + assert!(map.insert("foo".to_owned().into_cow(), 42).is_some()); assert!(map.insert("foo".into_cow(), 43).is_some()); - assert!(map.insert("foo".to_string().into_cow(), 44).is_some()); + assert!(map.insert("foo".to_owned().into_cow(), 44).is_some()); assert!(map.insert("foo".into_cow(), 45).is_some()); - assert!(map.insert("foo".to_string().into_cow(), 46).is_some()); + assert!(map.insert("foo".to_owned().into_cow(), 46).is_some()); let v = 46; - assert_eq!(map.get(&"foo".to_string().into_cow()), Some(&v)); + assert_eq!(map.get(&"foo".to_owned().into_cow()), Some(&v)); assert_eq!(map.get(&"foo".into_cow()), Some(&v)); let (a, b, c, d) = (50, 51, 52, 53); assert!(map.insert("abc".into_cow(), a).is_none()); - assert!(map.insert("bcd".to_string().into_cow(), b).is_none()); + assert!(map.insert("bcd".to_owned().into_cow(), b).is_none()); assert!(map.insert("cde".into_cow(), c).is_none()); - assert!(map.insert("def".to_string().into_cow(), d).is_none()); + assert!(map.insert("def".to_owned().into_cow(), d).is_none()); assert!(map.insert("abc".into_cow(), a).is_some()); - assert!(map.insert("bcd".to_string().into_cow(), b).is_some()); + assert!(map.insert("bcd".to_owned().into_cow(), b).is_some()); assert!(map.insert("cde".into_cow(), c).is_some()); - assert!(map.insert("def".to_string().into_cow(), d).is_some()); + assert!(map.insert("def".to_owned().into_cow(), d).is_some()); - assert!(map.insert("abc".to_string().into_cow(), a).is_some()); + assert!(map.insert("abc".to_owned().into_cow(), a).is_some()); assert!(map.insert("bcd".into_cow(), b).is_some()); - assert!(map.insert("cde".to_string().into_cow(), c).is_some()); + assert!(map.insert("cde".to_owned().into_cow(), c).is_some()); assert!(map.insert("def".into_cow(), d).is_some()); assert_eq!(map.get(&"abc".into_cow()), Some(&a)); @@ -57,14 +57,14 @@ pub fn main() { assert_eq!(map.get(&"cde".into_cow()), Some(&c)); assert_eq!(map.get(&"def".into_cow()), Some(&d)); - assert_eq!(map.get(&"abc".to_string().into_cow()), Some(&a)); - assert_eq!(map.get(&"bcd".to_string().into_cow()), Some(&b)); - assert_eq!(map.get(&"cde".to_string().into_cow()), Some(&c)); - assert_eq!(map.get(&"def".to_string().into_cow()), Some(&d)); + assert_eq!(map.get(&"abc".to_owned().into_cow()), Some(&a)); + assert_eq!(map.get(&"bcd".to_owned().into_cow()), Some(&b)); + assert_eq!(map.get(&"cde".to_owned().into_cow()), Some(&c)); + assert_eq!(map.get(&"def".to_owned().into_cow()), Some(&d)); assert!(map.remove(&"foo".into_cow()).is_some()); assert_eq!(map.into_iter().map(|(k, v)| format!("{}{}", k, v)) .collect::>() .concat(), - "abc50bcd51cde52def53".to_string()); + "abc50bcd51cde52def53".to_owned()); } diff --git a/src/test/run-pass/seq-compare.rs b/src/test/run-pass/seq-compare.rs index f1a21d90ab2dc..459ccf8f6db53 100644 --- a/src/test/run-pass/seq-compare.rs +++ b/src/test/run-pass/seq-compare.rs @@ -11,9 +11,9 @@ pub fn main() { - assert!(("hello".to_string() < "hellr".to_string())); - assert!(("hello ".to_string() > "hello".to_string())); - assert!(("hello".to_string() != "there".to_string())); + assert!(("hello".to_owned() < "hellr".to_owned())); + assert!(("hello ".to_owned() > "hello".to_owned())); + assert!(("hello".to_owned() != "there".to_owned())); 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/spawn-fn.rs b/src/test/run-pass/spawn-fn.rs index 4a35ed609e080..7aa8288bd5fa7 100644 --- a/src/test/run-pass/spawn-fn.rs +++ b/src/test/run-pass/spawn-fn.rs @@ -16,9 +16,9 @@ fn x(s: String, n: isize) { } pub fn main() { - let t1 = thread::spawn(|| x("hello from first spawned fn".to_string(), 65) ); - let t2 = thread::spawn(|| x("hello from second spawned fn".to_string(), 66) ); - let t3 = thread::spawn(|| x("hello from third spawned fn".to_string(), 67) ); + let t1 = thread::spawn(|| x("hello from first spawned fn".to_owned(), 65) ); + let t2 = thread::spawn(|| x("hello from second spawned fn".to_owned(), 66) ); + let t3 = thread::spawn(|| x("hello from third spawned fn".to_owned(), 67) ); let mut i = 30; while i > 0 { i = i - 1; diff --git a/src/test/run-pass/spawn-types.rs b/src/test/run-pass/spawn-types.rs index ae4fabd34d629..054a514c5b44b 100644 --- a/src/test/run-pass/spawn-types.rs +++ b/src/test/run-pass/spawn-types.rs @@ -21,11 +21,11 @@ use std::sync::mpsc::{channel, Sender}; type ctx = Sender; fn iotask(_tx: &ctx, ip: String) { - assert_eq!(ip, "localhost".to_string()); + assert_eq!(ip, "localhost".to_owned()); } pub fn main() { let (tx, _rx) = channel::(); - let t = thread::spawn(move|| iotask(&tx, "localhost".to_string()) ); + let t = thread::spawn(move|| iotask(&tx, "localhost".to_owned()) ); t.join().ok().unwrap(); } diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index 84bb1b871b97e..5eded912afe5a 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -60,9 +60,9 @@ impl vec_utils for Vec { pub fn main() { assert_eq!(10_usize.plus(), 30); - assert_eq!(("hi".to_string()).plus(), 200); + assert_eq!(("hi".to_owned()).plus(), 200); - assert_eq!((vec!(1)).length_().str(), "1".to_string()); + assert_eq!((vec!(1)).length_().str(), "1".to_owned()); let vect = vec!(3, 4).map_(|a| *a + 4); assert_eq!(vect[0], 7); let vect = (vec!(3, 4)).map_::(|a| *a as usize + 4_usize); diff --git a/src/test/run-pass/static-method-xcrate.rs b/src/test/run-pass/static-method-xcrate.rs index 57609cec9f2b0..2f2e623e725dc 100644 --- a/src/test/run-pass/static-method-xcrate.rs +++ b/src/test/run-pass/static-method-xcrate.rs @@ -16,8 +16,8 @@ extern crate static_methods_crate; use static_methods_crate::read; pub fn main() { - let result: isize = read("5".to_string()); + let result: isize = read("5".to_owned()); assert_eq!(result, 5); - assert_eq!(read::readMaybe("false".to_string()), Some(false)); - assert_eq!(read::readMaybe("foo".to_string()), None::); + assert_eq!(read::readMaybe("false".to_owned()), Some(false)); + assert_eq!(read::readMaybe("foo".to_owned()), None::); } diff --git a/src/test/run-pass/str-concat.rs b/src/test/run-pass/str-concat.rs index ad0d2f11abd86..cf441f945f230 100644 --- a/src/test/run-pass/str-concat.rs +++ b/src/test/run-pass/str-concat.rs @@ -12,8 +12,8 @@ pub fn main() { - let a: String = "hello".to_string(); - let b: String = "world".to_string(); + let a: String = "hello".to_owned(); + let b: String = "world".to_owned(); let s: String = format!("{}{}", a, b); println!("{}", s.clone()); assert_eq!(s.as_bytes()[9], 'd' as u8); diff --git a/src/test/run-pass/str-multiline.rs b/src/test/run-pass/str-multiline.rs index 94e14290498b8..ce3c74f832314 100644 --- a/src/test/run-pass/str-multiline.rs +++ b/src/test/run-pass/str-multiline.rs @@ -11,12 +11,12 @@ pub fn main() { let a: String = "this \ -is a test".to_string(); +is a test".to_owned(); let b: String = "this \ is \ another \ - test".to_string(); - assert_eq!(a, "this is a test".to_string()); - assert_eq!(b, "this is another test".to_string()); + test".to_owned(); + assert_eq!(a, "this is a test".to_owned()); + assert_eq!(b, "this is another test".to_owned()); } diff --git a/src/test/run-pass/string-self-append.rs b/src/test/run-pass/string-self-append.rs index cef7a93aeeddc..a76829aaa1ad7 100644 --- a/src/test/run-pass/string-self-append.rs +++ b/src/test/run-pass/string-self-append.rs @@ -10,7 +10,7 @@ pub fn main() { // Make sure we properly handle repeated self-appends. - let mut a: String = "A".to_string(); + let mut a: String = "A".to_owned(); let mut i = 20; let mut expected_len = 1; while i > 0 { 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 c3b1ff0f057be..fab243abf4aa1 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_string(), - baz: "two".to_string() + bar: "one".to_owned(), + baz: "two".to_owned() }; let foo_ = foo.clone(); diff --git a/src/test/run-pass/struct-literal-dtor.rs b/src/test/run-pass/struct-literal-dtor.rs index 61607cffc47fc..ff91cb4eebd13 100644 --- a/src/test/run-pass/struct-literal-dtor.rs +++ b/src/test/run-pass/struct-literal-dtor.rs @@ -20,6 +20,6 @@ impl Drop for foo { pub fn main() { let _z = foo { - x: "Hello".to_string() + x: "Hello".to_owned() }; } diff --git a/src/test/run-pass/struct-order-of-eval-1.rs b/src/test/run-pass/struct-order-of-eval-1.rs index b5e4011bbea58..e167930af252c 100644 --- a/src/test/run-pass/struct-order-of-eval-1.rs +++ b/src/test/run-pass/struct-order-of-eval-1.rs @@ -12,7 +12,7 @@ struct S { f0: String, f1: isize } pub fn main() { - let s = "Hello, world!".to_string(); + let s = "Hello, world!".to_owned(); let s = S { f0: s.to_string(), ..S { diff --git a/src/test/run-pass/struct-order-of-eval-2.rs b/src/test/run-pass/struct-order-of-eval-2.rs index 7ec28f597edbe..eb32670d6bc4b 100644 --- a/src/test/run-pass/struct-order-of-eval-2.rs +++ b/src/test/run-pass/struct-order-of-eval-2.rs @@ -15,7 +15,7 @@ struct S { } pub fn main() { - let s = "Hello, world!".to_string(); + let s = "Hello, world!".to_owned(); let s = S { f1: s.to_string(), f0: s diff --git a/src/test/run-pass/swap-overlapping.rs b/src/test/run-pass/swap-overlapping.rs index 2e5386d6866ed..bd1bc91acf053 100644 --- a/src/test/run-pass/swap-overlapping.rs +++ b/src/test/run-pass/swap-overlapping.rs @@ -17,7 +17,7 @@ use std::ptr; pub fn main() { let mut test = TestDescAndFn { desc: TestDesc { - name: TestName::DynTestName("test".to_string()), + name: TestName::DynTestName("test".to_owned()), should_fail: false }, testfn: TestFn::DynTestFn(22), diff --git a/src/test/run-pass/syntax-extension-source-utils.rs b/src/test/run-pass/syntax-extension-source-utils.rs index 8834fd39d1d88..f371d9047a7f4 100644 --- a/src/test/run-pass/syntax-extension-source-utils.rs +++ b/src/test/run-pass/syntax-extension-source-utils.rs @@ -28,10 +28,10 @@ pub fn main() { assert!((column!() == 4)); assert_eq!(indirect_line!(), 29); assert!((file!().ends_with("syntax-extension-source-utils.rs"))); - assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string()); + assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_owned()); assert!(include!("syntax-extension-source-utils-files/includeme.\ fragment").to_string() - == "victory robot 6".to_string()); + == "victory robot 6".to_owned()); assert!( include_str!("syntax-extension-source-utils-files/includeme.\ diff --git a/src/test/run-pass/tag-align-shape.rs b/src/test/run-pass/tag-align-shape.rs index 5db886c815b2a..887c1f919626d 100644 --- a/src/test/run-pass/tag-align-shape.rs +++ b/src/test/run-pass/tag-align-shape.rs @@ -23,5 +23,5 @@ pub fn main() { let x = t_rec {c8: 22, t: a_tag::a_tag_var(44)}; let y = format!("{:?}", x); println!("y = {:?}", y); - assert_eq!(y, "t_rec { c8: 22, t: a_tag_var(44) }".to_string()); + assert_eq!(y, "t_rec { c8: 22, t: a_tag_var(44) }".to_owned()); } diff --git a/src/test/run-pass/tag-disr-val-shape.rs b/src/test/run-pass/tag-disr-val-shape.rs index fba3f9fb0d028..2be0b2a5bd89b 100644 --- a/src/test/run-pass/tag-disr-val-shape.rs +++ b/src/test/run-pass/tag-disr-val-shape.rs @@ -20,7 +20,7 @@ enum color { pub fn main() { let act = format!("{:?}", color::red); println!("{}", act); - assert_eq!("red".to_string(), act); - assert_eq!("green".to_string(), format!("{:?}", color::green)); - assert_eq!("white".to_string(), format!("{:?}", color::white)); + assert_eq!("red".to_owned(), act); + assert_eq!("green".to_owned(), format!("{:?}", color::green)); + assert_eq!("white".to_owned(), format!("{:?}", color::white)); } diff --git a/src/test/run-pass/tag-variant-disr-val.rs b/src/test/run-pass/tag-variant-disr-val.rs index 6dc69656759de..5d757f5687d9d 100644 --- a/src/test/run-pass/tag-variant-disr-val.rs +++ b/src/test/run-pass/tag-variant-disr-val.rs @@ -30,14 +30,14 @@ impl PartialEq for color { } pub fn main() { - test_color(red, 0xff0000, "red".to_string()); - test_color(green, 0x00ff00, "green".to_string()); - test_color(blue, 0x0000ff, "blue".to_string()); - test_color(black, 0x000000, "black".to_string()); - test_color(white, 0xFFFFFF, "white".to_string()); - test_color(imaginary, -1, "imaginary".to_string()); - test_color(purple, 2, "purple".to_string()); - test_color(orange, 4, "orange".to_string()); + test_color(red, 0xff0000, "red".to_owned()); + test_color(green, 0x00ff00, "green".to_owned()); + test_color(blue, 0x0000ff, "blue".to_owned()); + test_color(black, 0x000000, "black".to_owned()); + test_color(white, 0xFFFFFF, "white".to_owned()); + test_color(imaginary, -1, "imaginary".to_owned()); + test_color(purple, 2, "purple".to_owned()); + test_color(orange, 4, "orange".to_owned()); } fn test_color(color: color, val: isize, name: String) { @@ -49,25 +49,25 @@ fn test_color(color: color, val: isize, name: String) { fn get_color_alt(color: color) -> String { match color { - red => {"red".to_string()} - green => {"green".to_string()} - blue => {"blue".to_string()} - black => {"black".to_string()} - white => {"white".to_string()} - imaginary => {"imaginary".to_string()} - purple => {"purple".to_string()} - orange => {"orange".to_string()} + red => {"red".to_owned()} + green => {"green".to_owned()} + blue => {"blue".to_owned()} + black => {"black".to_owned()} + white => {"white".to_owned()} + imaginary => {"imaginary".to_owned()} + purple => {"purple".to_owned()} + orange => {"orange".to_owned()} } } fn get_color_if(color: color) -> String { - if color == red {"red".to_string()} - else if color == green {"green".to_string()} - else if color == blue {"blue".to_string()} - else if color == black {"black".to_string()} - else if color == white {"white".to_string()} - else if color == imaginary {"imaginary".to_string()} - else if color == purple {"purple".to_string()} - else if color == orange {"orange".to_string()} - else {"unknown".to_string()} + if color == red {"red".to_owned()} + else if color == green {"green".to_owned()} + else if color == blue {"blue".to_owned()} + else if color == black {"black".to_owned()} + else if color == white {"white".to_owned()} + else if color == imaginary {"imaginary".to_owned()} + else if color == purple {"purple".to_owned()} + else if color == orange {"orange".to_owned()} + else {"unknown".to_owned()} } diff --git a/src/test/run-pass/tail-call-arg-leak.rs b/src/test/run-pass/tail-call-arg-leak.rs index 8842e1b85915b..a28d3f787ace7 100644 --- a/src/test/run-pass/tail-call-arg-leak.rs +++ b/src/test/run-pass/tail-call-arg-leak.rs @@ -17,5 +17,5 @@ fn inner(dummy: String, b: bool) { if b { return inner(dummy, false); } } pub fn main() { - inner("hi".to_string(), true); + inner("hi".to_owned(), true); } diff --git a/src/test/run-pass/task-comm-10.rs b/src/test/run-pass/task-comm-10.rs index a796750ef88b7..0a1566c46ed6c 100644 --- a/src/test/run-pass/task-comm-10.rs +++ b/src/test/run-pass/task-comm-10.rs @@ -20,10 +20,10 @@ fn start(tx: &Sender>) { let mut a; let mut b; a = rx.recv().unwrap(); - assert!(a == "A".to_string()); + assert!(a == "A".to_owned()); println!("{}", a); b = rx.recv().unwrap(); - assert!(b == "B".to_string()); + assert!(b == "B".to_owned()); println!("{}", b); } @@ -32,8 +32,8 @@ pub fn main() { let child = thread::spawn(move|| { start(&tx) }); let mut c = rx.recv().unwrap(); - c.send("A".to_string()).unwrap(); - c.send("B".to_string()).unwrap(); + c.send("A".to_owned()).unwrap(); + c.send("B".to_owned()).unwrap(); thread::yield_now(); child.join(); diff --git a/src/test/run-pass/task-comm-16.rs b/src/test/run-pass/task-comm-16.rs index c6d8f3c0d9b0b..9c39075c1c676 100644 --- a/src/test/run-pass/task-comm-16.rs +++ b/src/test/run-pass/task-comm-16.rs @@ -37,7 +37,7 @@ fn test_vec() { fn test_str() { let (tx, rx) = channel(); - let s0 = "test".to_string(); + let s0 = "test".to_owned(); tx.send(s0).unwrap(); let s1 = rx.recv().unwrap(); assert_eq!(s1.as_bytes()[0], 't' as u8); diff --git a/src/test/run-pass/task-life-0.rs b/src/test/run-pass/task-life-0.rs index ba8819fd0b0fe..c93c866cefb7a 100644 --- a/src/test/run-pass/task-life-0.rs +++ b/src/test/run-pass/task-life-0.rs @@ -15,7 +15,7 @@ use std::thread; pub fn main() { - thread::spawn(move|| child("Hello".to_string()) ).join(); + thread::spawn(move|| child("Hello".to_owned()) ).join(); } fn child(_s: String) { diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index 250ed58a8ef4c..10a514c444b95 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -62,20 +62,20 @@ impl Pet for Goldfyshe { } pub fn main() { - let catte = Catte { num_whiskers: 7, name: "alonzo_church".to_string() }; + let catte = Catte { num_whiskers: 7, name: "alonzo_church".to_owned() }; let dogge1 = Dogge { bark_decibels: 100, tricks_known: 42, - name: "alan_turing".to_string(), + name: "alan_turing".to_owned(), }; let dogge2 = Dogge { bark_decibels: 55, tricks_known: 11, - name: "albert_einstein".to_string(), + name: "albert_einstein".to_owned(), }; let fishe = Goldfyshe { swim_speed: 998, - name: "alec_guinness".to_string(), + name: "alec_guinness".to_owned(), }; let arc = Arc::new(vec!(box catte as Box, box dogge1 as Box, diff --git a/src/test/run-pass/trait-generic.rs b/src/test/run-pass/trait-generic.rs index 4998236629153..901a560573ff9 100644 --- a/src/test/run-pass/trait-generic.rs +++ b/src/test/run-pass/trait-generic.rs @@ -21,7 +21,7 @@ impl to_str for String { fn to_string_(&self) -> String { self.clone() } } impl to_str for () { - fn to_string_(&self) -> String { "()".to_string() } + fn to_string_(&self) -> String { "()".to_owned() } } trait map { @@ -38,16 +38,16 @@ impl map for Vec { } fn foo>(x: T) -> Vec { - x.map(|_e| "hi".to_string() ) + x.map(|_e| "hi".to_owned() ) } fn bar>(x: T) -> Vec { x.map(|_e| _e.to_string_() ) } pub fn main() { - assert_eq!(foo(vec!(1)), ["hi".to_string()]); - assert_eq!(bar:: >(vec!(4, 5)), ["4".to_string(), "5".to_string()]); - assert_eq!(bar:: >(vec!("x".to_string(), "y".to_string())), - ["x".to_string(), "y".to_string()]); - assert_eq!(bar::<(), Vec<()>>(vec!(())), ["()".to_string()]); + assert_eq!(foo(vec!(1)), ["hi".to_owned()]); + assert_eq!(bar:: >(vec!(4, 5)), ["4".to_owned(), "5".to_owned()]); + assert_eq!(bar:: >(vec!("x".to_owned(), "y".to_owned())), + ["x".to_owned(), "y".to_owned()]); + assert_eq!(bar::<(), Vec<()>>(vec!(())), ["()".to_owned()]); } diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs index a29e0e932c07d..db9eb2d66c1ef 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -29,16 +29,16 @@ impl to_str for Vec { } pub fn main() { - assert!(1.to_string_() == "1".to_string()); - assert!((vec!(2, 3, 4)).to_string_() == "[2, 3, 4]".to_string()); + assert!(1.to_string_() == "1".to_owned()); + assert!((vec!(2, 3, 4)).to_string_() == "[2, 3, 4]".to_owned()); fn indirect(x: T) -> String { format!("{}!", x.to_string_()) } - assert!(indirect(vec!(10, 20)) == "[10, 20]!".to_string()); + assert!(indirect(vec!(10, 20)) == "[10, 20]!".to_owned()); fn indirect2(x: T) -> String { indirect(x) } - assert!(indirect2(vec!(1)) == "[1]!".to_string()); + assert!(indirect2(vec!(1)) == "[1]!".to_owned()); } diff --git a/src/test/run-pass/trait-with-bounds-default.rs b/src/test/run-pass/trait-with-bounds-default.rs index cfd812400947e..f7fa36b7a08dd 100644 --- a/src/test/run-pass/trait-with-bounds-default.rs +++ b/src/test/run-pass/trait-with-bounds-default.rs @@ -37,5 +37,5 @@ impl Getter for Option { pub fn main() { assert_eq!(3.do_get2(), (3, 3)); - assert_eq!(Some("hi".to_string()).do_get2(), ("hi".to_string(), "hi".to_string())); + assert_eq!(Some("hi".to_owned()).do_get2(), ("hi".to_owned(), "hi".to_owned())); } diff --git a/src/test/run-pass/traits-default-method-macro.rs b/src/test/run-pass/traits-default-method-macro.rs index 193038d9e50f3..b3a81f5397fe6 100644 --- a/src/test/run-pass/traits-default-method-macro.rs +++ b/src/test/run-pass/traits-default-method-macro.rs @@ -25,5 +25,5 @@ impl Foo for Baz { pub fn main() { let q = Baz::Quux; - assert_eq!(q.bar(), "test".to_string()); + assert_eq!(q.bar(), "test".to_owned()); } diff --git a/src/test/run-pass/ufcs-polymorphic-paths.rs b/src/test/run-pass/ufcs-polymorphic-paths.rs index a8240dfbd1f8b..430b13478d828 100644 --- a/src/test/run-pass/ufcs-polymorphic-paths.rs +++ b/src/test/run-pass/ufcs-polymorphic-paths.rs @@ -127,11 +127,11 @@ tests! { >::add, fn(i32, i32) -> i32, (5, 6); String::into_cow, fn(String) -> Cow<'static, str>, - ("foo".to_string()); + ("foo".to_owned()); ::into_cow, fn(String) -> Cow<'static, str>, - ("foo".to_string()); + ("foo".to_owned()); >::into_cow, fn(String) -> Cow<'static, str>, - ("foo".to_string()); + ("foo".to_owned()); >::into_cow, fn(String) -> Cow<'static, str>, - ("foo".to_string()); + ("foo".to_owned()); } diff --git a/src/test/run-pass/utf8.rs b/src/test/run-pass/utf8.rs index ec1c6970ea0c9..60d4380dc825b 100644 --- a/src/test/run-pass/utf8.rs +++ b/src/test/run-pass/utf8.rs @@ -24,17 +24,17 @@ pub fn main() { assert_eq!(pi as isize, '\u{3a0}' as isize); assert_eq!('\x0a' as isize, '\n' as isize); - let bhutan: String = "འབྲུག་ཡུལ།".to_string(); - let japan: String = "日本".to_string(); - let uzbekistan: String = "Ўзбекистон".to_string(); - let austria: String = "Österreich".to_string(); + let bhutan: String = "འབྲུག་ཡུལ།".to_owned(); + let japan: String = "日本".to_owned(); + let uzbekistan: String = "Ўзбекистон".to_owned(); + let austria: String = "Österreich".to_owned(); let bhutan_e: String = - "\u{f60}\u{f56}\u{fb2}\u{f74}\u{f42}\u{f0b}\u{f61}\u{f74}\u{f63}\u{f0d}".to_string(); - let japan_e: String = "\u{65e5}\u{672c}".to_string(); + "\u{f60}\u{f56}\u{fb2}\u{f74}\u{f42}\u{f0b}\u{f61}\u{f74}\u{f63}\u{f0d}".to_owned(); + let japan_e: String = "\u{65e5}\u{672c}".to_owned(); let uzbekistan_e: String = - "\u{40e}\u{437}\u{431}\u{435}\u{43a}\u{438}\u{441}\u{442}\u{43e}\u{43d}".to_string(); - let austria_e: String = "\u{d6}sterreich".to_string(); + "\u{40e}\u{437}\u{431}\u{435}\u{43a}\u{438}\u{441}\u{442}\u{43e}\u{43d}".to_owned(); + let austria_e: String = "\u{d6}sterreich".to_owned(); let oo: char = 'Ö'; assert_eq!(oo as isize, 0xd6); diff --git a/src/test/run-pass/variant-attributes.rs b/src/test/run-pass/variant-attributes.rs index 18987d1e016b1..438b8bdd53ab6 100644 --- a/src/test/run-pass/variant-attributes.rs +++ b/src/test/run-pass/variant-attributes.rs @@ -41,5 +41,5 @@ fn boldly_go(_crew_member: crew_of_enterprise_d, _where: String) { } pub fn main() { boldly_go(crew_of_enterprise_d::worf, - "where no one has gone before".to_string()); + "where no one has gone before".to_owned()); } diff --git a/src/test/run-pass/vec-tail-matching.rs b/src/test/run-pass/vec-tail-matching.rs index 75f970543a45a..309ae45dfcbea 100644 --- a/src/test/run-pass/vec-tail-matching.rs +++ b/src/test/run-pass/vec-tail-matching.rs @@ -18,16 +18,16 @@ struct Foo { pub fn main() { let x = [ - Foo { string: "foo".to_string() }, - Foo { string: "bar".to_string() }, - Foo { string: "baz".to_string() } + Foo { string: "foo".to_owned() }, + Foo { string: "bar".to_owned() }, + Foo { string: "baz".to_owned() } ]; match x { [ref first, tail..] => { - assert!(first.string == "foo".to_string()); + assert!(first.string == "foo".to_owned()); assert_eq!(tail.len(), 2); - assert!(tail[0].string == "bar".to_string()); - assert!(tail[1].string == "baz".to_string()); + assert!(tail[0].string == "bar".to_owned()); + assert!(tail[1].string == "baz".to_owned()); match tail { [Foo { .. }, _, Foo { .. }, _tail..] => { diff --git a/src/test/run-pass/vec-to_str.rs b/src/test/run-pass/vec-to_str.rs index f000ada770a40..37b8eb8d7199b 100644 --- a/src/test/run-pass/vec-to_str.rs +++ b/src/test/run-pass/vec-to_str.rs @@ -10,7 +10,7 @@ pub fn main() { - assert_eq!(format!("{:?}", vec!(0, 1)), "[0, 1]".to_string()); + assert_eq!(format!("{:?}", vec!(0, 1)), "[0, 1]".to_owned()); let foo = vec!(3, 4); let bar: &[isize] = &[4, 5];