Skip to content

Commit c1d8c78

Browse files
committed
wip: check for error directly
1 parent 3c4118a commit c1d8c78

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

  • crates
    • criterion_compat/criterion_fork/src/analysis
    • divan_compat/divan_fork/src

crates/criterion_compat/criterion_fork/src/analysis/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,13 @@ mod codspeed {
297297
) {
298298
let (uri, bench_name) = create_uri_and_name(id, c);
299299

300-
let result = ::codspeed::fifo::send_cmd(codspeed::fifo::Command::CurrentBenchmark {
300+
if let Err(error) = ::codspeed::fifo::send_cmd(codspeed::fifo::Command::CurrentBenchmark {
301301
pid: std::process::id(),
302302
uri: uri.clone(),
303-
});
304-
if result.is_err() && std::env::var("CODSPEED_ENV").is_ok() {
305-
eprintln!("Failed to send benchmark URI to runner: {error:?}");
303+
}) {
304+
if std::env::var("CODSPEED_ENV").is_ok() {
305+
eprintln!("Failed to send benchmark URI to runner: {error:?}");
306+
}
306307
}
307308

308309
let avg_iter_per_round = iters.iter().sum::<f64>() / iters.len() as f64;

crates/divan_compat/divan_fork/src/divan.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,12 +428,13 @@ mod codspeed {
428428
bench_context.samples.time_samples.iter().map(|s| s.duration.picos / 1_000).collect();
429429
let max_time_ns = bench_context.options.max_time.map(|t| t.as_nanos());
430430

431-
let result = ::codspeed::fifo::send_cmd(codspeed::fifo::Command::CurrentBenchmark {
431+
if let Err(error) = ::codspeed::fifo::send_cmd(codspeed::fifo::Command::CurrentBenchmark {
432432
pid: std::process::id(),
433433
uri: uri.clone(),
434-
});
435-
if result.is_err() && std::env::var("CODSPEED_ENV").is_ok() {
436-
eprintln!("Failed to send benchmark URI to runner: {error:?}");
434+
}) {
435+
if std::env::var("CODSPEED_ENV").is_ok() {
436+
eprintln!("Failed to send benchmark URI to runner: {error:?}");
437+
}
437438
}
438439

439440
::codspeed::walltime::collect_raw_walltime_results(

0 commit comments

Comments
 (0)