Skip to content

Commit 487fdee

Browse files
committed
fix(criterion): add a default measurement to the benchmark group struct
1 parent 68a0039 commit 487fdee

File tree

1 file changed

+6
-3
lines changed
  • crates/criterion_compat/src/compat

1 file changed

+6
-3
lines changed

crates/criterion_compat/src/compat/group.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@ use std::marker::PhantomData;
22
use std::{cell::RefCell, rc::Rc, time::Duration};
33

44
use codspeed::{codspeed::CodSpeed, utils::get_git_relative_path};
5+
use criterion::measurement::WallTime;
56
use criterion::{measurement::Measurement, PlotConfiguration, SamplingMode, Throughput};
67

78
use crate::{Bencher, Criterion};
89

9-
pub struct BenchmarkGroup<M: Measurement> {
10+
/// Deprecated: using the default measurement will be removed in the next major version.
11+
/// Defaulting to WallTime differs from the original BenchmarkGroup implementation but avoids creating a breaking change
12+
pub struct BenchmarkGroup<M: Measurement = WallTime> {
1013
codspeed: Rc<RefCell<CodSpeed>>,
1114
current_file: String,
1215
macro_group: String,
1316
group_name: String,
14-
phantom: PhantomData<*const M>,
17+
_marker: PhantomData<*const M>,
1518
}
1619

1720
impl<M: Measurement> BenchmarkGroup<M> {
@@ -25,7 +28,7 @@ impl<M: Measurement> BenchmarkGroup<M> {
2528
current_file: criterion.current_file.clone(),
2629
macro_group: criterion.macro_group.clone(),
2730
group_name,
28-
phantom: PhantomData,
31+
_marker: PhantomData,
2932
}
3033
}
3134

0 commit comments

Comments
 (0)