From 17eee3333a7b66ad9828f52fdcaef914e7d241ff Mon Sep 17 00:00:00 2001 From: Marcono1234 Date: Sat, 18 Feb 2023 23:01:27 +0100 Subject: [PATCH] Remove unnecessary `pub` from example code Using `pub` is not necessary for the benchmark functions and prevents the compiler from detecting unused benchmark functions. --- book/src/getting_started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/src/getting_started.md b/book/src/getting_started.md index 157e09b2..e3d662a0 100644 --- a/book/src/getting_started.md +++ b/book/src/getting_started.md @@ -42,7 +42,7 @@ below for an explanation of this code): use criterion::{black_box, criterion_group, criterion_main, Criterion}; use mycrate::fibonacci; -pub fn criterion_benchmark(c: &mut Criterion) { +fn criterion_benchmark(c: &mut Criterion) { c.bench_function("fib 20", |b| b.iter(|| fibonacci(black_box(20)))); }