Skip to content

Commit 919889a

Browse files
richobrson
authored andcommitted
Replace all ~"" with "".to_owned()
1 parent b75683c commit 919889a

File tree

383 files changed

+2910
-2817
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

383 files changed

+2910
-2817
lines changed

src/compiletest/compiletest.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub fn parse_config(args: Vec<~str> ) -> config {
9393
assert!(!args.is_empty());
9494
let argv0 = (*args.get(0)).clone();
9595
let args_ = args.tail();
96-
if *args.get(1) == ~"-h" || *args.get(1) == ~"--help" {
96+
if *args.get(1) == "-h".to_owned() || *args.get(1) == "--help".to_owned() {
9797
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
9898
println!("{}", getopts::usage(message, groups.as_slice()));
9999
println!("");
@@ -181,7 +181,7 @@ pub fn log_config(config: &config) {
181181
logv(c, format!("adb_test_dir: {}", config.adb_test_dir));
182182
logv(c, format!("adb_device_status: {}", config.adb_device_status));
183183
match config.test_shard {
184-
None => logv(c, ~"test_shard: (all)"),
184+
None => logv(c, "test_shard: (all)".to_owned()),
185185
Some((a,b)) => logv(c, format!("test_shard: {}.{}", a, b))
186186
}
187187
logv(c, format!("verbose: {}", config.verbose));
@@ -199,7 +199,7 @@ pub fn opt_str<'a>(maybestr: &'a Option<~str>) -> &'a str {
199199
}
200200

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

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

217217
pub fn mode_str(mode: mode) -> ~str {
218218
match mode {
219-
mode_compile_fail => ~"compile-fail",
220-
mode_run_fail => ~"run-fail",
221-
mode_run_pass => ~"run-pass",
222-
mode_pretty => ~"pretty",
223-
mode_debug_info => ~"debug-info",
224-
mode_codegen => ~"codegen",
219+
mode_compile_fail => "compile-fail".to_owned(),
220+
mode_run_fail => "run-fail".to_owned(),
221+
mode_run_pass => "run-pass".to_owned(),
222+
mode_pretty => "pretty".to_owned(),
223+
mode_debug_info => "debug-info".to_owned(),
224+
mode_codegen => "codegen".to_owned(),
225225
}
226226
}
227227

228228
pub fn run_tests(config: &config) {
229-
if config.target == ~"arm-linux-androideabi" {
229+
if config.target == "arm-linux-androideabi".to_owned() {
230230
match config.mode{
231231
mode_debug_info => {
232232
println!("arm-linux-androideabi debug-info \
@@ -296,10 +296,10 @@ pub fn is_test(config: &config, testfile: &Path) -> bool {
296296
// Pretty-printer does not work with .rc files yet
297297
let valid_extensions =
298298
match config.mode {
299-
mode_pretty => vec!(~".rs"),
300-
_ => vec!(~".rc", ~".rs")
299+
mode_pretty => vec!(".rs".to_owned()),
300+
_ => vec!(".rc".to_owned(), ".rs".to_owned())
301301
};
302-
let invalid_prefixes = vec!(~".", ~"#", ~"~");
302+
let invalid_prefixes = vec!(".".to_owned(), "#".to_owned(), "~".to_owned());
303303
let name = testfile.filename_str().unwrap();
304304

305305
let mut valid = false;

src/compiletest/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn load_errors(testfile: &Path) -> Vec<ExpectedError> {
3131

3232
fn parse_expected(line_num: uint, line: ~str) -> Vec<ExpectedError> {
3333
let line = line.trim();
34-
let error_tag = ~"//~";
34+
let error_tag = "//~".to_owned();
3535
let mut idx;
3636
match line.find_str(error_tag) {
3737
None => return Vec::new(),

src/compiletest/header.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ pub fn load_props(testfile: &Path) -> TestProps {
112112

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

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

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

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

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

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

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

171171
fn parse_force_host(line: &str) -> bool {
@@ -181,12 +181,12 @@ fn parse_no_prefer_dynamic(line: &str) -> bool {
181181
}
182182

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

188188
match strs.len() {
189-
1u => (strs.pop().unwrap(), ~""),
189+
1u => (strs.pop().unwrap(), "".to_owned()),
190190
2u => {
191191
let end = strs.pop().unwrap();
192192
(strs.pop().unwrap(), end)
@@ -197,7 +197,7 @@ fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {
197197
}
198198

199199
fn parse_pp_exact(line: &str, testfile: &Path) -> Option<Path> {
200-
match parse_name_value_directive(line, ~"pp-exact") {
200+
match parse_name_value_directive(line, "pp-exact".to_owned()) {
201201
Some(s) => Some(Path::new(s)),
202202
None => {
203203
if parse_name_directive(line, "pp-exact") {

src/compiletest/procsrv.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(~str, ~str)> {
2929
(k, new_v)
3030
}).collect();
3131
if prog.ends_with("rustc.exe") {
32-
new_env.push((~"RUST_THREADS", ~"1"));
32+
new_env.push(("RUST_THREADS".to_owned(), "1".to_owned()));
3333
}
3434
return new_env;
3535
}
@@ -49,7 +49,7 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(~str,~str)> {
4949
};
5050
let prev = match env.iter().position(|&(ref k, _)| k.as_slice() == var) {
5151
Some(i) => env.remove(i).unwrap().val1(),
52-
None => ~"",
52+
None => "".to_owned(),
5353
};
5454
env.push((var.to_owned(), if prev.is_empty() {
5555
lib_path + ":" + aux_path

0 commit comments

Comments
 (0)