Skip to content

Commit 189930f

Browse files
committed
Auto merge of #21916 - japaric:no-as-slice, r=alexcrichton
r? @alexcrichton cc @eddyb
2 parents 2c05354 + 17bc7d8 commit 189930f

File tree

289 files changed

+1372
-1406
lines changed

Some content is hidden

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

289 files changed

+1372
-1406
lines changed

Diff for: src/compiletest/compiletest.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,22 @@ pub fn parse_config(args: Vec<String> ) -> Config {
9797
assert!(!args.is_empty());
9898
let argv0 = args[0].clone();
9999
let args_ = args.tail();
100-
if args[1].as_slice() == "-h" || args[1].as_slice() == "--help" {
100+
if args[1] == "-h" || args[1] == "--help" {
101101
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
102-
println!("{}", getopts::usage(message.as_slice(), groups.as_slice()));
102+
println!("{}", getopts::usage(&message, &groups));
103103
println!("");
104104
panic!()
105105
}
106106

107107
let matches =
108-
&match getopts::getopts(args_.as_slice(), groups.as_slice()) {
108+
&match getopts::getopts(args_, &groups) {
109109
Ok(m) => m,
110110
Err(f) => panic!("{:?}", f)
111111
};
112112

113113
if matches.opt_present("h") || matches.opt_present("help") {
114114
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
115-
println!("{}", getopts::usage(message.as_slice(), groups.as_slice()));
115+
println!("{}", getopts::usage(&message, &groups));
116116
println!("");
117117
panic!()
118118
}
@@ -156,9 +156,9 @@ pub fn parse_config(args: Vec<String> ) -> Config {
156156
adb_test_dir: opt_str2(matches.opt_str("adb-test-dir")),
157157
adb_device_status:
158158
"arm-linux-androideabi" ==
159-
opt_str2(matches.opt_str("target")).as_slice() &&
159+
opt_str2(matches.opt_str("target")) &&
160160
"(none)" !=
161-
opt_str2(matches.opt_str("adb-test-dir")).as_slice() &&
161+
opt_str2(matches.opt_str("adb-test-dir")) &&
162162
!opt_str2(matches.opt_str("adb-test-dir")).is_empty(),
163163
lldb_python_dir: matches.opt_str("lldb-python-dir"),
164164
verbose: matches.opt_present("verbose"),
@@ -201,7 +201,7 @@ pub fn log_config(config: &Config) {
201201
pub fn opt_str<'a>(maybestr: &'a Option<String>) -> &'a str {
202202
match *maybestr {
203203
None => "(none)",
204-
Some(ref s) => s.as_slice(),
204+
Some(ref s) => s,
205205
}
206206
}
207207

@@ -213,7 +213,7 @@ pub fn opt_str2(maybestr: Option<String>) -> String {
213213
}
214214

215215
pub fn run_tests(config: &Config) {
216-
if config.target.as_slice() == "arm-linux-androideabi" {
216+
if config.target == "arm-linux-androideabi" {
217217
match config.mode {
218218
DebugInfoGdb => {
219219
println!("arm-linux-androideabi debug-info \
@@ -306,13 +306,13 @@ pub fn is_test(config: &Config, testfile: &Path) -> bool {
306306
let mut valid = false;
307307

308308
for ext in &valid_extensions {
309-
if name.ends_with(ext.as_slice()) {
309+
if name.ends_with(ext) {
310310
valid = true;
311311
}
312312
}
313313

314314
for pre in &invalid_prefixes {
315-
if name.starts_with(pre.as_slice()) {
315+
if name.starts_with(pre) {
316316
valid = false;
317317
}
318318
}

Diff for: src/compiletest/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn load_errors(testfile: &Path) -> Vec<ExpectedError> {
4444
rdr.lines().enumerate().filter_map(|(line_no, ln)| {
4545
parse_expected(last_nonfollow_error,
4646
line_no + 1,
47-
ln.unwrap().as_slice())
47+
&ln.unwrap())
4848
.map(|(which, error)| {
4949
match which {
5050
FollowPrevious(_) => {}

Diff for: src/compiletest/header.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
145145

146146
pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
147147
fn ignore_target(config: &Config) -> String {
148-
format!("ignore-{}", util::get_os(config.target.as_slice()))
148+
format!("ignore-{}", util::get_os(&config.target))
149149
}
150150
fn ignore_stage(config: &Config) -> String {
151151
format!("ignore-{}",
@@ -169,8 +169,8 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
169169
.expect("Malformed GDB version directive");
170170
// Ignore if actual version is smaller the minimum required
171171
// version
172-
gdb_version_to_int(actual_version.as_slice()) <
173-
gdb_version_to_int(min_version.as_slice())
172+
gdb_version_to_int(actual_version) <
173+
gdb_version_to_int(min_version)
174174
} else {
175175
false
176176
}
@@ -197,8 +197,8 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
197197
.expect("Malformed lldb version directive");
198198
// Ignore if actual version is smaller the minimum required
199199
// version
200-
lldb_version_to_int(actual_version.as_slice()) <
201-
lldb_version_to_int(min_version.as_slice())
200+
lldb_version_to_int(actual_version) <
201+
lldb_version_to_int(min_version)
202202
} else {
203203
false
204204
}
@@ -209,8 +209,8 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
209209

210210
let val = iter_header(testfile, |ln| {
211211
!parse_name_directive(ln, "ignore-test") &&
212-
!parse_name_directive(ln, ignore_target(config).as_slice()) &&
213-
!parse_name_directive(ln, ignore_stage(config).as_slice()) &&
212+
!parse_name_directive(ln, &ignore_target(config)) &&
213+
!parse_name_directive(ln, &ignore_stage(config)) &&
214214
!(config.mode == common::Pretty && parse_name_directive(ln, "ignore-pretty")) &&
215215
!(config.target != config.host && parse_name_directive(ln, "ignore-cross-compile")) &&
216216
!ignore_gdb(config, ln) &&
@@ -294,7 +294,7 @@ fn parse_pretty_compare_only(line: &str) -> bool {
294294
fn parse_exec_env(line: &str) -> Option<(String, String)> {
295295
parse_name_value_directive(line, "exec-env").map(|nv| {
296296
// nv is either FOO or FOO=BAR
297-
let mut strs: Vec<String> = nv.as_slice()
297+
let mut strs: Vec<String> = nv
298298
.splitn(1, '=')
299299
.map(|s| s.to_string())
300300
.collect();
@@ -330,7 +330,7 @@ fn parse_name_directive(line: &str, directive: &str) -> bool {
330330
pub fn parse_name_value_directive(line: &str, directive: &str)
331331
-> Option<String> {
332332
let keycolon = format!("{}:", directive);
333-
match line.find_str(keycolon.as_slice()) {
333+
match line.find_str(&keycolon) {
334334
Some(colon) => {
335335
let value = line[(colon + keycolon.len()) .. line.len()].to_string();
336336
debug!("{}: {}", directive, value);
@@ -344,16 +344,16 @@ pub fn gdb_version_to_int(version_string: &str) -> int {
344344
let error_string = format!(
345345
"Encountered GDB version string with unexpected format: {}",
346346
version_string);
347-
let error_string = error_string.as_slice();
347+
let error_string = error_string;
348348

349349
let components: Vec<&str> = version_string.trim().split('.').collect();
350350

351351
if components.len() != 2 {
352352
panic!("{}", error_string);
353353
}
354354

355-
let major: int = components[0].parse().ok().expect(error_string);
356-
let minor: int = components[1].parse().ok().expect(error_string);
355+
let major: int = components[0].parse().ok().expect(&error_string);
356+
let minor: int = components[1].parse().ok().expect(&error_string);
357357

358358
return major * 1000 + minor;
359359
}
@@ -362,7 +362,7 @@ pub fn lldb_version_to_int(version_string: &str) -> int {
362362
let error_string = format!(
363363
"Encountered LLDB version string with unexpected format: {}",
364364
version_string);
365-
let error_string = error_string.as_slice();
366-
let major: int = version_string.parse().ok().expect(error_string);
365+
let error_string = error_string;
366+
let major: int = version_string.parse().ok().expect(&error_string);
367367
return major;
368368
}

Diff for: src/compiletest/procsrv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) {
2323

2424
// Add the new dylib search path var
2525
let var = DynamicLibrary::envvar();
26-
let newpath = DynamicLibrary::create_path(path.as_slice());
26+
let newpath = DynamicLibrary::create_path(&path);
2727
let newpath = String::from_utf8(newpath).unwrap();
2828
cmd.env(var.to_string(), newpath);
2929
}

0 commit comments

Comments
 (0)