The first thing to do is update the Cargo.toml to disable the libtest
benchmark harness:
[[bench]]name = "example"harness = false
We also need to add Criterion.rs to the dev-dependencies section of Cargo.toml:
[dev-dependencies]criterion = "0.5.1"
The next step is to update the imports:
#![allow(unused)]fnmain() {
use criterion::{black_box, criterion_group, criterion_main, Criterion};
}
Then, we can change the bench_fib function. Remove the #[bench] and change
the argument to &mut Criterion instead. The contents of this function need to
change as well: