@@ -85,7 +85,6 @@ pub use uefi_raw::protocol::device_path::{DeviceSubType, DeviceType};
8585use crate :: proto:: { unsafe_protocol, ProtocolPointer } ;
8686use core:: ffi:: c_void;
8787use core:: fmt:: { self , Debug , Display , Formatter } ;
88- use core:: mem;
8988use core:: ops:: Deref ;
9089use ptr_meta:: Pointee ;
9190
9695 crate :: { CString16 , Identify } ,
9796 alloc:: borrow:: ToOwned ,
9897 alloc:: boxed:: Box ,
98+ core:: mem,
9999} ;
100100
101101opaque_type ! {
@@ -122,7 +122,7 @@ impl<'a> TryFrom<&'a [u8]> for &'a DevicePathHeader {
122122 type Error = ByteConversionError ;
123123
124124 fn try_from ( bytes : & [ u8 ] ) -> Result < Self , Self :: Error > {
125- if mem :: size_of :: < DevicePathHeader > ( ) <= bytes. len ( ) {
125+ if size_of :: < DevicePathHeader > ( ) <= bytes. len ( ) {
126126 unsafe { Ok ( & * bytes. as_ptr ( ) . cast :: < DevicePathHeader > ( ) ) }
127127 } else {
128128 Err ( ByteConversionError :: InvalidLength )
@@ -173,7 +173,7 @@ impl DevicePathNode {
173173 pub unsafe fn from_ffi_ptr < ' a > ( ptr : * const FfiDevicePath ) -> & ' a Self {
174174 let header = * ptr. cast :: < DevicePathHeader > ( ) ;
175175
176- let data_len = usize:: from ( header. length ) - mem :: size_of :: < DevicePathHeader > ( ) ;
176+ let data_len = usize:: from ( header. length ) - size_of :: < DevicePathHeader > ( ) ;
177177 & * ptr_meta:: from_raw_parts ( ptr. cast ( ) , data_len)
178178 }
179179
@@ -748,7 +748,7 @@ mod tests {
748748 path. push ( device_type) ;
749749 path. push ( sub_type) ;
750750 path. extend (
751- u16:: try_from ( mem :: size_of :: < DevicePathHeader > ( ) + node_data. len ( ) )
751+ u16:: try_from ( size_of :: < DevicePathHeader > ( ) + node_data. len ( ) )
752752 . unwrap ( )
753753 . to_le_bytes ( ) ,
754754 ) ;
@@ -787,7 +787,7 @@ mod tests {
787787 assert_eq ! ( node. sub_type( ) . 0 , sub_type) ;
788788 assert_eq ! (
789789 node. length( ) ,
790- u16 :: try_from( mem :: size_of:: <DevicePathHeader >( ) + node_data. len( ) ) . unwrap( )
790+ u16 :: try_from( size_of:: <DevicePathHeader >( ) + node_data. len( ) ) . unwrap( )
791791 ) ;
792792 assert_eq ! ( & node. data, node_data) ;
793793 }
@@ -798,7 +798,7 @@ mod tests {
798798 let dp = unsafe { DevicePath :: from_ffi_ptr ( raw_data. as_ptr ( ) . cast ( ) ) } ;
799799
800800 // Check that the size is the sum of the nodes' lengths.
801- assert_eq ! ( mem :: size_of_val( dp) , 6 + 8 + 4 + 6 + 8 + 4 ) ;
801+ assert_eq ! ( size_of_val( dp) , 6 + 8 + 4 + 6 + 8 + 4 ) ;
802802
803803 // Check the list's node iter.
804804 let nodes: Vec < _ > = dp. node_iter ( ) . collect ( ) ;
@@ -824,7 +824,7 @@ mod tests {
824824 // Check the list's instance iter.
825825 let mut iter = dp. instance_iter ( ) ;
826826 let mut instance = iter. next ( ) . unwrap ( ) ;
827- assert_eq ! ( mem :: size_of_val( instance) , 6 + 8 + 4 ) ;
827+ assert_eq ! ( size_of_val( instance) , 6 + 8 + 4 ) ;
828828
829829 // Check the first instance's node iter.
830830 let nodes: Vec < _ > = instance. node_iter ( ) . collect ( ) ;
@@ -835,7 +835,7 @@ mod tests {
835835
836836 // Check second instance.
837837 instance = iter. next ( ) . unwrap ( ) ;
838- assert_eq ! ( mem :: size_of_val( instance) , 6 + 8 + 4 ) ;
838+ assert_eq ! ( size_of_val( instance) , 6 + 8 + 4 ) ;
839839
840840 let nodes: Vec < _ > = instance. node_iter ( ) . collect ( ) ;
841841 check_node ( nodes[ 0 ] , 0xa2 , 0xb2 , & [ 30 , 31 ] ) ;
@@ -876,15 +876,15 @@ mod tests {
876876 // Raw data is long enough to hold a [`DevicePathNode`].
877877 raw_data. push ( node[ 1 ] ) ;
878878 raw_data. extend (
879- u16:: try_from ( mem :: size_of :: < DevicePathHeader > ( ) + node_data. len ( ) )
879+ u16:: try_from ( size_of :: < DevicePathHeader > ( ) + node_data. len ( ) )
880880 . unwrap ( )
881881 . to_le_bytes ( ) ,
882882 ) ;
883883 raw_data. extend ( node_data) ;
884884 let dp = <& DevicePathNode >:: try_from ( raw_data. as_slice ( ) ) . unwrap ( ) ;
885885
886886 // Relevant assertions to verify the conversion is fine.
887- assert_eq ! ( mem :: size_of_val( dp) , 6 ) ;
887+ assert_eq ! ( size_of_val( dp) , 6 ) ;
888888 check_node ( dp, 0xa0 , 0xb0 , & [ 10 , 11 ] ) ;
889889
890890 // [`DevicePathNode`] data length exceeds the raw_data slice.
@@ -898,7 +898,7 @@ mod tests {
898898 let dp = <& DevicePath >:: try_from ( raw_data. as_slice ( ) ) . unwrap ( ) ;
899899
900900 // Check that the size is the sum of the nodes' lengths.
901- assert_eq ! ( mem :: size_of_val( dp) , 6 + 8 + 4 + 6 + 8 + 4 ) ;
901+ assert_eq ! ( size_of_val( dp) , 6 + 8 + 4 + 6 + 8 + 4 ) ;
902902
903903 // Check the list's node iter.
904904 let nodes: Vec < _ > = dp. node_iter ( ) . collect ( ) ;
0 commit comments