Skip to content

Commit 911cc9c

Browse files
committed
auto merge of #14414 : richo/rust/features/nerf_unused_string_fns, r=alexcrichton
This should block on #14323
2 parents 30bf73f + c256dcf commit 911cc9c

File tree

387 files changed

+3019
-3015
lines changed

Some content is hidden

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

387 files changed

+3019
-3015
lines changed

src/compiletest/compiletest.rs

+24-24
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn start(argc: int, argv: **u8) -> int {
5050
pub fn main() {
5151
let args = os::args();
5252
let config = parse_config(args.move_iter()
53-
.map(|x| x.to_strbuf())
53+
.map(|x| x.to_string())
5454
.collect());
5555
log_config(&config);
5656
run_tests(&config);
@@ -134,15 +134,15 @@ pub fn parse_config(args: Vec<String> ) -> Config {
134134
Config {
135135
compile_lib_path: matches.opt_str("compile-lib-path")
136136
.unwrap()
137-
.to_strbuf(),
138-
run_lib_path: matches.opt_str("run-lib-path").unwrap().to_strbuf(),
137+
.to_string(),
138+
run_lib_path: matches.opt_str("run-lib-path").unwrap().to_string(),
139139
rustc_path: opt_path(matches, "rustc-path"),
140140
clang_path: matches.opt_str("clang-path").map(|s| Path::new(s)),
141141
llvm_bin_path: matches.opt_str("llvm-bin-path").map(|s| Path::new(s)),
142142
src_base: opt_path(matches, "src-base"),
143143
build_base: opt_path(matches, "build-base"),
144144
aux_base: opt_path(matches, "aux-base"),
145-
stage_id: matches.opt_str("stage-id").unwrap().to_strbuf(),
145+
stage_id: matches.opt_str("stage-id").unwrap().to_string(),
146146
mode: FromStr::from_str(matches.opt_str("mode")
147147
.unwrap()
148148
.as_slice()).expect("invalid mode"),
@@ -156,32 +156,32 @@ pub fn parse_config(args: Vec<String> ) -> Config {
156156
ratchet_noise_percent:
157157
matches.opt_str("ratchet-noise-percent")
158158
.and_then(|s| from_str::<f64>(s.as_slice())),
159-
runtool: matches.opt_str("runtool").map(|x| x.to_strbuf()),
159+
runtool: matches.opt_str("runtool").map(|x| x.to_string()),
160160
host_rustcflags: matches.opt_str("host-rustcflags")
161-
.map(|x| x.to_strbuf()),
161+
.map(|x| x.to_string()),
162162
target_rustcflags: matches.opt_str("target-rustcflags")
163-
.map(|x| x.to_strbuf()),
163+
.map(|x| x.to_string()),
164164
jit: matches.opt_present("jit"),
165-
target: opt_str2(matches.opt_str("target").map(|x| x.to_strbuf())),
166-
host: opt_str2(matches.opt_str("host").map(|x| x.to_strbuf())),
165+
target: opt_str2(matches.opt_str("target").map(|x| x.to_string())),
166+
host: opt_str2(matches.opt_str("host").map(|x| x.to_string())),
167167
android_cross_path: opt_path(matches, "android-cross-path"),
168168
adb_path: opt_str2(matches.opt_str("adb-path")
169-
.map(|x| x.to_strbuf())),
169+
.map(|x| x.to_string())),
170170
adb_test_dir: opt_str2(matches.opt_str("adb-test-dir")
171-
.map(|x| x.to_strbuf())),
171+
.map(|x| x.to_string())),
172172
adb_device_status:
173173
"arm-linux-androideabi" ==
174174
opt_str2(matches.opt_str("target")
175-
.map(|x| x.to_strbuf())).as_slice() &&
175+
.map(|x| x.to_string())).as_slice() &&
176176
"(none)" !=
177177
opt_str2(matches.opt_str("adb-test-dir")
178-
.map(|x| x.to_strbuf())).as_slice() &&
178+
.map(|x| x.to_string())).as_slice() &&
179179
!opt_str2(matches.opt_str("adb-test-dir")
180-
.map(|x| x.to_strbuf())).is_empty(),
180+
.map(|x| x.to_string())).is_empty(),
181181
lldb_python_dir: matches.opt_str("lldb-python-dir")
182-
.map(|x| x.to_strbuf()),
182+
.map(|x| x.to_string()),
183183
test_shard: test::opt_shard(matches.opt_str("test-shard")
184-
.map(|x| x.to_strbuf())),
184+
.map(|x| x.to_string())),
185185
verbose: matches.opt_present("verbose")
186186
}
187187
}
@@ -201,7 +201,7 @@ pub fn log_config(config: &Config) {
201201
opt_str(&config.filter
202202
.as_ref()
203203
.map(|re| {
204-
re.to_str().into_strbuf()
204+
re.to_str().into_string()
205205
}))));
206206
logv(c, format_strbuf!("runtool: {}", opt_str(&config.runtool)));
207207
logv(c, format_strbuf!("host-rustcflags: {}",
@@ -218,7 +218,7 @@ pub fn log_config(config: &Config) {
218218
logv(c, format_strbuf!("adb_device_status: {}",
219219
config.adb_device_status));
220220
match config.test_shard {
221-
None => logv(c, "test_shard: (all)".to_strbuf()),
221+
None => logv(c, "test_shard: (all)".to_string()),
222222
Some((a,b)) => logv(c, format_strbuf!("test_shard: {}.{}", a, b))
223223
}
224224
logv(c, format_strbuf!("verbose: {}", config.verbose));
@@ -234,7 +234,7 @@ pub fn opt_str<'a>(maybestr: &'a Option<String>) -> &'a str {
234234

235235
pub fn opt_str2(maybestr: Option<String>) -> String {
236236
match maybestr {
237-
None => "(none)".to_strbuf(),
237+
None => "(none)".to_string(),
238238
Some(s) => s,
239239
}
240240
}
@@ -314,10 +314,10 @@ pub fn is_test(config: &Config, testfile: &Path) -> bool {
314314
// Pretty-printer does not work with .rc files yet
315315
let valid_extensions =
316316
match config.mode {
317-
Pretty => vec!(".rs".to_owned()),
318-
_ => vec!(".rc".to_owned(), ".rs".to_owned())
317+
Pretty => vec!(".rs".to_string()),
318+
_ => vec!(".rc".to_string(), ".rs".to_string())
319319
};
320-
let invalid_prefixes = vec!(".".to_owned(), "#".to_owned(), "~".to_owned());
320+
let invalid_prefixes = vec!(".".to_string(), "#".to_string(), "~".to_string());
321321
let name = testfile.filename_str().unwrap();
322322

323323
let mut valid = false;
@@ -367,7 +367,7 @@ pub fn make_test_name(config: &Config, testfile: &Path) -> test::TestName {
367367
pub fn make_test_closure(config: &Config, testfile: &Path) -> test::TestFn {
368368
let config = (*config).clone();
369369
// FIXME (#9639): This needs to handle non-utf8 paths
370-
let testfile = testfile.as_str().unwrap().to_strbuf();
370+
let testfile = testfile.as_str().unwrap().to_string();
371371
test::DynTestFn(proc() {
372372
runtest::run(config, testfile)
373373
})
@@ -376,7 +376,7 @@ pub fn make_test_closure(config: &Config, testfile: &Path) -> test::TestFn {
376376
pub fn make_metrics_test_closure(config: &Config, testfile: &Path) -> test::TestFn {
377377
let config = (*config).clone();
378378
// FIXME (#9639): This needs to handle non-utf8 paths
379-
let testfile = testfile.as_str().unwrap().to_strbuf();
379+
let testfile = testfile.as_str().unwrap().to_string();
380380
test::DynMetricFn(proc(mm) {
381381
runtest::run_metrics(config, testfile, mm)
382382
})

src/compiletest/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ pub fn load_errors(re: &Regex, testfile: &Path) -> Vec<ExpectedError> {
3131
fn parse_expected(line_num: uint, line: &str, re: &Regex) -> Option<ExpectedError> {
3232
re.captures(line).and_then(|caps| {
3333
let adjusts = caps.name("adjusts").len();
34-
let kind = caps.name("kind").to_ascii().to_lower().into_str().to_strbuf();
35-
let msg = caps.name("msg").trim().to_strbuf();
34+
let kind = caps.name("kind").to_ascii().to_lower().into_str().to_string();
35+
let msg = caps.name("msg").trim().to_string();
3636

3737
debug!("line={} kind={} msg={}", line_num, kind, msg);
3838
Some(ExpectedError {

src/compiletest/header.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,23 @@ fn iter_header(testfile: &Path, it: |&str| -> bool) -> bool {
170170
}
171171

172172
fn parse_error_pattern(line: &str) -> Option<String> {
173-
parse_name_value_directive(line, "error-pattern".to_strbuf())
173+
parse_name_value_directive(line, "error-pattern".to_string())
174174
}
175175

176176
fn parse_aux_build(line: &str) -> Option<String> {
177-
parse_name_value_directive(line, "aux-build".to_strbuf())
177+
parse_name_value_directive(line, "aux-build".to_string())
178178
}
179179

180180
fn parse_compile_flags(line: &str) -> Option<String> {
181-
parse_name_value_directive(line, "compile-flags".to_strbuf())
181+
parse_name_value_directive(line, "compile-flags".to_string())
182182
}
183183

184184
fn parse_run_flags(line: &str) -> Option<String> {
185-
parse_name_value_directive(line, "run-flags".to_strbuf())
185+
parse_name_value_directive(line, "run-flags".to_string())
186186
}
187187

188188
fn parse_check_line(line: &str) -> Option<String> {
189-
parse_name_value_directive(line, "check".to_strbuf())
189+
parse_name_value_directive(line, "check".to_string())
190190
}
191191

192192
fn parse_force_host(line: &str) -> bool {
@@ -206,15 +206,15 @@ fn parse_no_pretty_expanded(line: &str) -> bool {
206206
}
207207

208208
fn parse_exec_env(line: &str) -> Option<(String, String)> {
209-
parse_name_value_directive(line, "exec-env".to_strbuf()).map(|nv| {
209+
parse_name_value_directive(line, "exec-env".to_string()).map(|nv| {
210210
// nv is either FOO or FOO=BAR
211211
let mut strs: Vec<String> = nv.as_slice()
212212
.splitn('=', 1)
213-
.map(|s| s.to_strbuf())
213+
.map(|s| s.to_string())
214214
.collect();
215215

216216
match strs.len() {
217-
1u => (strs.pop().unwrap(), "".to_strbuf()),
217+
1u => (strs.pop().unwrap(), "".to_string()),
218218
2u => {
219219
let end = strs.pop().unwrap();
220220
(strs.pop().unwrap(), end)
@@ -225,7 +225,7 @@ fn parse_exec_env(line: &str) -> Option<(String, String)> {
225225
}
226226

227227
fn parse_pp_exact(line: &str, testfile: &Path) -> Option<Path> {
228-
match parse_name_value_directive(line, "pp-exact".to_strbuf()) {
228+
match parse_name_value_directive(line, "pp-exact".to_string()) {
229229
Some(s) => Some(Path::new(s)),
230230
None => {
231231
if parse_name_directive(line, "pp-exact") {
@@ -247,7 +247,7 @@ pub fn parse_name_value_directive(line: &str, directive: String)
247247
match line.find_str(keycolon.as_slice()) {
248248
Some(colon) => {
249249
let value = line.slice(colon + keycolon.len(),
250-
line.len()).to_strbuf();
250+
line.len()).to_string();
251251
debug!("{}: {}", directive, value);
252252
Some(value)
253253
}

src/compiletest/procsrv.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::unstable::dynamic_lib::DynamicLibrary;
1515

1616
fn target_env(lib_path: &str, prog: &str) -> Vec<(String, String)> {
1717
let prog = if cfg!(windows) {prog.slice_to(prog.len() - 4)} else {prog};
18-
let mut aux_path = prog.to_strbuf();
18+
let mut aux_path = prog.to_string();
1919
aux_path.push_str(".libaux");
2020

2121
// Need to be sure to put both the lib_path and the aux path in the dylib
@@ -27,16 +27,16 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(String, String)> {
2727
// Remove the previous dylib search path var
2828
let var = DynamicLibrary::envvar();
2929
let mut env: Vec<(String,String)> =
30-
os::env().move_iter().map(|(a,b)|(a.to_strbuf(), b.to_strbuf())).collect();
30+
os::env().move_iter().map(|(a,b)|(a.to_string(), b.to_string())).collect();
3131
match env.iter().position(|&(ref k, _)| k.as_slice() == var) {
3232
Some(i) => { env.remove(i); }
3333
None => {}
3434
}
3535

3636
// Add the new dylib search path var
3737
let newpath = DynamicLibrary::create_path(path.as_slice());
38-
env.push((var.to_strbuf(),
39-
str::from_utf8(newpath.as_slice()).unwrap().to_strbuf()));
38+
env.push((var.to_string(),
39+
str::from_utf8(newpath.as_slice()).unwrap().to_string()));
4040
return env;
4141
}
4242

@@ -59,8 +59,8 @@ pub fn run(lib_path: &str,
5959

6060
Some(Result {
6161
status: status,
62-
out: str::from_utf8(output.as_slice()).unwrap().to_strbuf(),
63-
err: str::from_utf8(error.as_slice()).unwrap().to_strbuf()
62+
out: str::from_utf8(output.as_slice()).unwrap().to_string(),
63+
err: str::from_utf8(error.as_slice()).unwrap().to_string()
6464
})
6565
},
6666
Err(..) => None

0 commit comments

Comments
 (0)