diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-26 21:21:15 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-27 09:03:06 -0500 |
| commit | bce81e24647507c82e02e9918f54e8e3a2431149 (patch) | |
| tree | d9137df10f07d1c9c5f8743d02c774a7add29a7f /src/compiletest | |
| parent | d77f6d5366b330f9c2061cad0d3ff638c9cc05b7 (diff) | |
| download | rust-bce81e24647507c82e02e9918f54e8e3a2431149.tar.gz rust-bce81e24647507c82e02e9918f54e8e3a2431149.zip | |
cleanup: s/`v.slice*()`/`&v[a..b]`/g + remove redundant `as_slice()` calls
Diffstat (limited to 'src/compiletest')
| -rw-r--r-- | src/compiletest/compiletest.rs | 8 | ||||
| -rw-r--r-- | src/compiletest/header.rs | 8 | ||||
| -rw-r--r-- | src/compiletest/runtest.rs | 12 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index b95e956aca2..07dcc57de26 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -361,8 +361,8 @@ pub fn make_metrics_test_closure(config: &Config, testfile: &Path) -> test::Test fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> { match full_version_line { Some(ref full_version_line) - if full_version_line.as_slice().trim().len() > 0 => { - let full_version_line = full_version_line.as_slice().trim(); + if full_version_line.trim().len() > 0 => { + let full_version_line = full_version_line.trim(); // used to be a regex "(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)" for (pos, c) in full_version_line.char_indices() { @@ -401,8 +401,8 @@ fn extract_lldb_version(full_version_line: Option<String>) -> Option<String> { match full_version_line { Some(ref full_version_line) - if full_version_line.as_slice().trim().len() > 0 => { - let full_version_line = full_version_line.as_slice().trim(); + if full_version_line.trim().len() > 0 => { + let full_version_line = full_version_line.trim(); for (pos, l) in full_version_line.char_indices() { if l != 'l' && l != 'L' { continue } diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 8458d880d05..f83c27b75d6 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -149,7 +149,7 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool { } fn ignore_stage(config: &Config) -> String { format!("ignore-{}", - config.stage_id.as_slice().split('-').next().unwrap()) + config.stage_id.split('-').next().unwrap()) } fn ignore_gdb(config: &Config, line: &str) -> bool { if config.mode != common::DebugInfoGdb { @@ -231,11 +231,11 @@ fn iter_header<F>(testfile: &Path, mut it: F) -> bool where // module or function. This doesn't seem to be an optimization // with a warm page cache. Maybe with a cold one. let ln = ln.unwrap(); - if ln.as_slice().starts_with("fn") || - ln.as_slice().starts_with("mod") { + if ln.starts_with("fn") || + ln.starts_with("mod") { return true; } else { - if !(it(ln.as_slice().trim())) { + if !(it(ln.trim())) { return false; } } diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 0ae32bd00a4..18cb3d1d5b0 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -777,7 +777,7 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str) for line in reader.lines() { match line { Ok(line) => { - if line.as_slice().contains("#break") { + if line.contains("#break") { breakpoint_lines.push(counter); } @@ -843,7 +843,7 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String]) // check if each line in props.check_lines appears in the // output (in order) let mut i = 0u; - for line in debugger_run_result.stdout.as_slice().lines() { + for line in debugger_run_result.stdout.lines() { let mut rest = line.trim(); let mut first = true; let mut failed = false; @@ -895,7 +895,7 @@ fn check_error_patterns(props: &TestProps, let mut next_err_idx = 0u; let mut next_err_pat = &props.error_patterns[next_err_idx]; let mut done = false; - for line in output_to_check.as_slice().lines() { + for line in output_to_check.lines() { if line.contains(next_err_pat.as_slice()) { debug!("found error pattern {}", next_err_pat); next_err_idx += 1u; @@ -924,7 +924,7 @@ fn check_error_patterns(props: &TestProps, } fn check_no_compiler_crash(proc_res: &ProcRes) { - for line in proc_res.stderr.as_slice().lines() { + for line in proc_res.stderr.lines() { if line.starts_with("error: internal compiler error:") { fatal_proc_rec("compiler encountered internal error", proc_res); @@ -983,7 +983,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> , // filename:line1:col1: line2:col2: *warning:* msg // where line1:col1: is the starting point, line2:col2: // is the ending point, and * represents ANSI color codes. - for line in proc_res.stderr.as_slice().lines() { + for line in proc_res.stderr.lines() { let mut was_expected = false; for (i, ee) in expected_errors.iter().enumerate() { if !found_flags[i] { @@ -1536,7 +1536,7 @@ fn _arm_exec_compiled_test(config: &Config, .expect(format!("failed to exec `{}`", config.adb_path).as_slice()); let mut exitcode: int = 0; - for c in exitcode_out.as_slice().chars() { + for c in exitcode_out.chars() { if !c.is_numeric() { break; } exitcode = exitcode * 10 + match c { '0' ... '9' => c as int - ('0' as int), |
