Skip to content

Commit a6fb339

Browse files
committed
feat: update black_box() usage
See rust-lang/rust#133942, there's not much point in using `black_box()` on a unit type, especially since `map.insert()` has side-effects and will be executed.
1 parent c8feb2a commit a6fb339

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

benches/benches/bevy_reflect/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ fn dynamic_map_insert(criterion: &mut Criterion) {
265265
|mut map| {
266266
for i in 0..size as u64 {
267267
let key = black_box(i);
268-
black_box(map.insert(key, i));
268+
map.insert(key, black_box(i));
269269
}
270270
},
271271
BatchSize::SmallInput,

benches/benches/bevy_reflect/struct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ fn dynamic_struct_insert(criterion: &mut Criterion) {
313313
bencher.iter_batched(
314314
|| s.clone_dynamic(),
315315
|mut s| {
316-
black_box(s.insert(black_box(&field), ()));
316+
s.insert(black_box(&field), ());
317317
},
318318
BatchSize::SmallInput,
319319
);

0 commit comments

Comments
 (0)