Skip to content

Commit fb0b65f

Browse files
committed
fixup: move setup to with_inputs
1 parent 3018c4d commit fb0b65f

1 file changed

Lines changed: 18 additions & 14 deletions

File tree

‎go-runner/benches/go_runner.rs‎

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,25 @@ fn bench_go_runner(bencher: divan::Bencher) {
55

66
let project_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("testdata/projects/example");
77

8-
let temp_dir = TempDir::new().unwrap();
9-
let profile_dir = temp_dir.path().join("profile");
10-
let cli = codspeed_go_runner::cli::Cli {
11-
packages: vec!["./...".into()],
12-
dry_run: true,
13-
..Default::default()
14-
};
8+
bencher
9+
.with_inputs(|| {
10+
let temp_dir = TempDir::new().unwrap();
11+
let profile_dir = temp_dir.path().join("profile");
12+
let cli = codspeed_go_runner::cli::Cli {
13+
packages: vec!["./...".into()],
14+
dry_run: true,
15+
..Default::default()
16+
};
1517

16-
bencher.bench(|| {
17-
if let Err(error) =
18-
codspeed_go_runner::run_benchmarks(&profile_dir, project_dir.as_path(), &cli)
19-
{
20-
panic!("Benchmarks couldn't run: {error}");
21-
}
22-
});
18+
(profile_dir, cli)
19+
})
20+
.bench_refs(|(profile_dir, cli)| {
21+
if let Err(error) =
22+
codspeed_go_runner::run_benchmarks(profile_dir, project_dir.as_path(), cli)
23+
{
24+
panic!("Benchmarks couldn't run: {error}");
25+
}
26+
});
2327
}
2428

2529
fn main() {

0 commit comments

Comments
 (0)