diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-04 22:05:29 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-05 17:22:14 -0500 |
| commit | 37448506ea575d94389a60dce2aaebd57dba50a3 (patch) | |
| tree | f302fb71c35d3708d23f30d07d0e128d3e36fb84 | |
| parent | b4ccc901660f08c7555ef8b1ce3e94fb12890a15 (diff) | |
compiletest: remove boxed closures
| -rw-r--r-- | src/compiletest/compiletest.rs | 5 | ||||
| -rw-r--r-- | src/compiletest/header.rs | 4 | ||||
| -rw-r--r-- | src/compiletest/runtest.rs | 14 |
3 files changed, 14 insertions, 9 deletions
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 350a10ce483..48610b6b526 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -339,8 +339,9 @@ pub fn is_test(config: &Config, testfile: &Path) -> bool { return valid; } -pub fn make_test(config: &Config, testfile: &Path, f: || -> test::TestFn) - -> test::TestDescAndFn { +pub fn make_test<F>(config: &Config, testfile: &Path, f: F) -> test::TestDescAndFn where + F: FnOnce() -> test::TestFn, +{ test::TestDescAndFn { desc: test::TestDesc { name: make_test_name(config, testfile), diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 27be6c6d835..2413a001ee8 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -220,7 +220,9 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool { !val } -fn iter_header(testfile: &Path, it: |&str| -> bool) -> bool { +fn iter_header<F>(testfile: &Path, mut it: F) -> bool where + F: FnMut(&str) -> bool, +{ use std::io::{BufferedReader, File}; let mut rdr = BufferedReader::new(File::open(testfile).unwrap()); diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index c513aec0b84..875061e69b7 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -1233,12 +1233,14 @@ enum TargetLocation { ThisDirectory(Path), } -fn make_compile_args(config: &Config, - props: &TestProps, - extras: Vec<String> , - xform: |&Config, &Path| -> TargetLocation, - testfile: &Path) - -> ProcArgs { +fn make_compile_args<F>(config: &Config, + props: &TestProps, + extras: Vec<String> , + xform: F, + testfile: &Path) + -> ProcArgs where + F: FnOnce(&Config, &Path) -> TargetLocation, +{ let xform_file = xform(config, testfile); let target = if props.force_host { config.host.as_slice() |
