compiletest: remove boxed closures

This commit is contained in:
Jorge Aparicio 2015-01-04 22:05:29 -05:00
parent b4ccc90166
commit 37448506ea
3 changed files with 14 additions and 9 deletions

View File

@ -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),

View File

@ -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());

View File

@ -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()