File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ fn bench_getrandom<const N: usize>(b: &mut test::Bencher) {
13
13
b. iter ( || {
14
14
let mut buf = [ 0u8 ; N ] ;
15
15
getrandom:: getrandom ( & mut buf[ ..] ) . unwrap ( ) ;
16
- test:: black_box ( & buf) ;
16
+ test:: black_box ( buf) ;
17
17
} ) ;
18
18
}
19
19
@@ -26,8 +26,9 @@ fn bench_getrandom_uninit<const N: usize>(b: &mut test::Bencher) {
26
26
// TODO: When the feature `maybe_uninit_as_bytes` is available, use:
27
27
// since that is the shape we expect most callers to have.
28
28
let mut buf: MaybeUninit < [ u8 ; N ] > = MaybeUninit :: uninit ( ) ;
29
- let buf = getrandom:: getrandom_uninit ( buf. as_bytes_mut ( ) ) . unwrap ( ) ;
30
- test:: black_box ( buf) ;
29
+ let _ = getrandom:: getrandom_uninit ( buf. as_bytes_mut ( ) ) . unwrap ( ) ;
30
+ let buf: [ u8 ; N ] = unsafe { buf. assume_init ( ) } ;
31
+ test:: black_box ( buf)
31
32
} ) ;
32
33
}
33
34
You can’t perform that action at this time.
0 commit comments