Skip to content

Commit 91aef25

Browse files
committed
Adapt gix-config/gix-object benches to changes in criterion
`criterion` 0.6.0 deprecates `criterion::black_box()`, preferring `std::hint::black_box()` (which `criterion::black_box()` now consists of a call to). This commit makes the recommended switch, in benches for `gix-config` and `gix-object` where `criterion::black_box()` was used, to `std::hint::black_box()`, fixing new clippy errors. Fuzz tests have also been using `black_box()`, but they already imported it from `std::hint`, and thus need no corresponding fix.
1 parent eccd13a commit 91aef25

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

gix-config/benches/large_config_file.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use criterion::{black_box, criterion_group, criterion_main, Criterion};
1+
use criterion::{criterion_group, criterion_main, Criterion};
22
use gix_config::{parse::Events, File};
3+
use std::hint::black_box;
34

45
fn gix_config(c: &mut Criterion) {
56
c.bench_function("GitConfig large config file", |b| {

gix-object/benches/decode_objects.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use criterion::{black_box, criterion_group, criterion_main, Criterion};
1+
use criterion::{criterion_group, criterion_main, Criterion};
2+
use std::hint::black_box;
23

34
fn parse_commit(c: &mut Criterion) {
45
c.bench_function("CommitRef(sig)", |b| {

gix-object/benches/edit_tree.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use std::{cell::RefCell, rc::Rc};
1+
use std::{cell::RefCell, hint::black_box, rc::Rc};
22

3-
use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};
3+
use criterion::{criterion_group, criterion_main, Criterion, Throughput};
44
use gix_hash::ObjectId;
55
use gix_hashtable::hash_map::Entry;
66
use gix_object::{tree, tree::EntryKind, Tree, WriteTo};

0 commit comments

Comments
 (0)