Skip to content

Commit

Permalink
Replace all ~"" with "".to_owned()
Browse files Browse the repository at this point in the history
  • Loading branch information
richo authored and brson committed Apr 19, 2014
1 parent b75683c commit 919889a
Show file tree
Hide file tree
Showing 383 changed files with 2,910 additions and 2,817 deletions.
26 changes: 13 additions & 13 deletions src/compiletest/compiletest.rs
Expand Up @@ -93,7 +93,7 @@ pub fn parse_config(args: Vec<~str> ) -> config {
assert!(!args.is_empty());
let argv0 = (*args.get(0)).clone();
let args_ = args.tail();
if *args.get(1) == ~"-h" || *args.get(1) == ~"--help" {
if *args.get(1) == "-h".to_owned() || *args.get(1) == "--help".to_owned() {
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
println!("{}", getopts::usage(message, groups.as_slice()));
println!("");
Expand Down Expand Up @@ -181,7 +181,7 @@ pub fn log_config(config: &config) {
logv(c, format!("adb_test_dir: {}", config.adb_test_dir));
logv(c, format!("adb_device_status: {}", config.adb_device_status));
match config.test_shard {
None => logv(c, ~"test_shard: (all)"),
None => logv(c, "test_shard: (all)".to_owned()),
Some((a,b)) => logv(c, format!("test_shard: {}.{}", a, b))
}
logv(c, format!("verbose: {}", config.verbose));
Expand All @@ -199,7 +199,7 @@ pub fn opt_str<'a>(maybestr: &'a Option<~str>) -> &'a str {
}

pub fn opt_str2(maybestr: Option<~str>) -> ~str {
match maybestr { None => ~"(none)", Some(s) => { s } }
match maybestr { None => "(none)".to_owned(), Some(s) => { s } }
}

pub fn str_mode(s: ~str) -> mode {
Expand All @@ -216,17 +216,17 @@ pub fn str_mode(s: ~str) -> mode {

pub fn mode_str(mode: mode) -> ~str {
match mode {
mode_compile_fail => ~"compile-fail",
mode_run_fail => ~"run-fail",
mode_run_pass => ~"run-pass",
mode_pretty => ~"pretty",
mode_debug_info => ~"debug-info",
mode_codegen => ~"codegen",
mode_compile_fail => "compile-fail".to_owned(),
mode_run_fail => "run-fail".to_owned(),
mode_run_pass => "run-pass".to_owned(),
mode_pretty => "pretty".to_owned(),
mode_debug_info => "debug-info".to_owned(),
mode_codegen => "codegen".to_owned(),
}
}

pub fn run_tests(config: &config) {
if config.target == ~"arm-linux-androideabi" {
if config.target == "arm-linux-androideabi".to_owned() {
match config.mode{
mode_debug_info => {
println!("arm-linux-androideabi debug-info \
Expand Down Expand Up @@ -296,10 +296,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 {
mode_pretty => vec!(~".rs"),
_ => vec!(~".rc", ~".rs")
mode_pretty => vec!(".rs".to_owned()),
_ => vec!(".rc".to_owned(), ".rs".to_owned())
};
let invalid_prefixes = vec!(~".", ~"#", ~"~");
let invalid_prefixes = vec!(".".to_owned(), "#".to_owned(), "~".to_owned());
let name = testfile.filename_str().unwrap();

let mut valid = false;
Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/errors.rs
Expand Up @@ -31,7 +31,7 @@ pub fn load_errors(testfile: &Path) -> Vec<ExpectedError> {

fn parse_expected(line_num: uint, line: ~str) -> Vec<ExpectedError> {
let line = line.trim();
let error_tag = ~"//~";
let error_tag = "//~".to_owned();
let mut idx;
match line.find_str(error_tag) {
None => return Vec::new(),
Expand Down
20 changes: 10 additions & 10 deletions src/compiletest/header.rs
Expand Up @@ -112,10 +112,10 @@ pub fn load_props(testfile: &Path) -> TestProps {

pub fn is_test_ignored(config: &config, testfile: &Path) -> bool {
fn ignore_target(config: &config) -> ~str {
~"ignore-" + util::get_os(config.target)
"ignore-".to_owned() + util::get_os(config.target)
}
fn ignore_stage(config: &config) -> ~str {
~"ignore-" + config.stage_id.split('-').next().unwrap()
"ignore-".to_owned() + config.stage_id.split('-').next().unwrap()
}

let val = iter_header(testfile, |ln| {
Expand Down Expand Up @@ -149,23 +149,23 @@ fn iter_header(testfile: &Path, it: |&str| -> bool) -> bool {
}

fn parse_error_pattern(line: &str) -> Option<~str> {
parse_name_value_directive(line, ~"error-pattern")
parse_name_value_directive(line, "error-pattern".to_owned())
}

fn parse_aux_build(line: &str) -> Option<~str> {
parse_name_value_directive(line, ~"aux-build")
parse_name_value_directive(line, "aux-build".to_owned())
}

fn parse_compile_flags(line: &str) -> Option<~str> {
parse_name_value_directive(line, ~"compile-flags")
parse_name_value_directive(line, "compile-flags".to_owned())
}

fn parse_debugger_cmd(line: &str) -> Option<~str> {
parse_name_value_directive(line, ~"debugger")
parse_name_value_directive(line, "debugger".to_owned())
}

fn parse_check_line(line: &str) -> Option<~str> {
parse_name_value_directive(line, ~"check")
parse_name_value_directive(line, "check".to_owned())
}

fn parse_force_host(line: &str) -> bool {
Expand All @@ -181,12 +181,12 @@ fn parse_no_prefer_dynamic(line: &str) -> bool {
}

fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {
parse_name_value_directive(line, ~"exec-env").map(|nv| {
parse_name_value_directive(line, "exec-env".to_owned()).map(|nv| {
// nv is either FOO or FOO=BAR
let mut strs: Vec<~str> = nv.splitn('=', 1).map(|s| s.to_owned()).collect();

match strs.len() {
1u => (strs.pop().unwrap(), ~""),
1u => (strs.pop().unwrap(), "".to_owned()),
2u => {
let end = strs.pop().unwrap();
(strs.pop().unwrap(), end)
Expand All @@ -197,7 +197,7 @@ fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {
}

fn parse_pp_exact(line: &str, testfile: &Path) -> Option<Path> {
match parse_name_value_directive(line, ~"pp-exact") {
match parse_name_value_directive(line, "pp-exact".to_owned()) {
Some(s) => Some(Path::new(s)),
None => {
if parse_name_directive(line, "pp-exact") {
Expand Down
4 changes: 2 additions & 2 deletions src/compiletest/procsrv.rs
Expand Up @@ -29,7 +29,7 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(~str, ~str)> {
(k, new_v)
}).collect();
if prog.ends_with("rustc.exe") {
new_env.push((~"RUST_THREADS", ~"1"));
new_env.push(("RUST_THREADS".to_owned(), "1".to_owned()));
}
return new_env;
}
Expand All @@ -49,7 +49,7 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(~str,~str)> {
};
let prev = match env.iter().position(|&(ref k, _)| k.as_slice() == var) {
Some(i) => env.remove(i).unwrap().val1(),
None => ~"",
None => "".to_owned(),
};
env.push((var.to_owned(), if prev.is_empty() {
lib_path + ":" + aux_path
Expand Down

5 comments on commit 919889a

@bors
Copy link
Contributor

@bors bors commented on 919889a Apr 19, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at brson@919889a

@bors
Copy link
Contributor

@bors bors commented on 919889a Apr 19, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging brson/rust/to_owned = 919889a into auto

@bors
Copy link
Contributor

@bors bors commented on 919889a Apr 19, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brson/rust/to_owned = 919889a merged ok, testing candidate = af24045

@bors
Copy link
Contributor

@bors bors commented on 919889a Apr 19, 2014

@bors
Copy link
Contributor

@bors bors commented on 919889a Apr 19, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = af24045

Please sign in to comment.