diff --git a/src/criterion.rs b/src/criterion.rs index 5ae2a7c..efc6522 100644 --- a/src/criterion.rs +++ b/src/criterion.rs @@ -379,9 +379,12 @@ impl Criterion { // --ignored overwrites any name-based filters passed in. BenchmarkFilter::RejectAll } else if let Some(filter) = opts.filter.as_ref() { - // if opts.exact { - BenchmarkFilter::Exact(filter.to_owned()) - // } + let filter = filter.to_owned(); + if opts.exact { + BenchmarkFilter::Exact(filter) + } else { + BenchmarkFilter::Substring(filter) + } } else { BenchmarkFilter::AcceptAll }; @@ -475,6 +478,7 @@ impl Criterion { BenchmarkFilter::AcceptAll => true, BenchmarkFilter::Exact(exact) => id == exact, BenchmarkFilter::RejectAll => false, + BenchmarkFilter::Substring(s) => id.contains(s), } } diff --git a/src/lib.rs b/src/lib.rs index ba6822e..ad70278 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -291,6 +291,8 @@ pub enum BenchmarkFilter { AcceptAll, /// Run the benchmark matching this string exactly. Exact(String), + /// Look for benchmark that contain substring + Substring(String), /// Do not run any benchmarks. RejectAll, }