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 @@ -1942,7 +1942,7 @@ pub struct ProtocolSearchKey(NonNull<c_void>);
1942
1942
1943
1943
#[ cfg( test) ]
1944
1944
mod tests {
1945
- use core:: mem:: size_of;
1945
+ use core:: mem:: { size_of, size_of_val } ;
1946
1946
1947
1947
use crate :: table:: boot:: { MemoryAttribute , MemoryMap , MemoryType } ;
1948
1948
@@ -1952,8 +1952,9 @@ mod tests {
1952
1952
let desc_count = buffer. len ( ) ;
1953
1953
1954
1954
let byte_buffer = {
1955
- let size = desc_count * size_of :: < MemoryDescriptor > ( ) ;
1956
- unsafe { core:: slice:: from_raw_parts_mut ( buffer. as_mut_ptr ( ) as * mut u8 , size) }
1955
+ unsafe {
1956
+ core:: slice:: from_raw_parts_mut ( buffer. as_mut_ptr ( ) as * mut u8 , size_of_val ( buffer) )
1957
+ }
1957
1958
} ;
1958
1959
1959
1960
MemoryMap :: from_raw ( byte_buffer, size_of :: < MemoryDescriptor > ( ) )
You can’t perform that action at this time.
0 commit comments