File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 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) {
1313 b. iter ( || {
1414 let mut buf = [ 0u8 ; N ] ;
1515 getrandom:: getrandom ( & mut buf[ ..] ) . unwrap ( ) ;
16- test:: black_box ( & buf) ;
16+ test:: black_box ( buf) ;
1717 } ) ;
1818}
1919
@@ -26,8 +26,9 @@ fn bench_getrandom_uninit<const N: usize>(b: &mut test::Bencher) {
2626 // TODO: When the feature `maybe_uninit_as_bytes` is available, use:
2727 // since that is the shape we expect most callers to have.
2828 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)
3132 } ) ;
3233}
3334
You can’t perform that action at this time.
0 commit comments