@@ -85,7 +85,6 @@ pub use uefi_raw::protocol::device_path::{DeviceSubType, DeviceType};
85
85
use crate :: proto:: { unsafe_protocol, ProtocolPointer } ;
86
86
use core:: ffi:: c_void;
87
87
use core:: fmt:: { self , Debug , Display , Formatter } ;
88
- use core:: mem;
89
88
use core:: ops:: Deref ;
90
89
use ptr_meta:: Pointee ;
91
90
96
95
crate :: { CString16 , Identify } ,
97
96
alloc:: borrow:: ToOwned ,
98
97
alloc:: boxed:: Box ,
98
+ core:: mem,
99
99
} ;
100
100
101
101
opaque_type ! {
@@ -122,7 +122,7 @@ impl<'a> TryFrom<&'a [u8]> for &'a DevicePathHeader {
122
122
type Error = ByteConversionError ;
123
123
124
124
fn try_from ( bytes : & [ u8 ] ) -> Result < Self , Self :: Error > {
125
- if mem :: size_of :: < DevicePathHeader > ( ) <= bytes. len ( ) {
125
+ if size_of :: < DevicePathHeader > ( ) <= bytes. len ( ) {
126
126
unsafe { Ok ( & * bytes. as_ptr ( ) . cast :: < DevicePathHeader > ( ) ) }
127
127
} else {
128
128
Err ( ByteConversionError :: InvalidLength )
@@ -173,7 +173,7 @@ impl DevicePathNode {
173
173
pub unsafe fn from_ffi_ptr < ' a > ( ptr : * const FfiDevicePath ) -> & ' a Self {
174
174
let header = * ptr. cast :: < DevicePathHeader > ( ) ;
175
175
176
- let data_len = usize:: from ( header. length ) - mem :: size_of :: < DevicePathHeader > ( ) ;
176
+ let data_len = usize:: from ( header. length ) - size_of :: < DevicePathHeader > ( ) ;
177
177
& * ptr_meta:: from_raw_parts ( ptr. cast ( ) , data_len)
178
178
}
179
179
@@ -748,7 +748,7 @@ mod tests {
748
748
path. push ( device_type) ;
749
749
path. push ( sub_type) ;
750
750
path. extend (
751
- u16:: try_from ( mem :: size_of :: < DevicePathHeader > ( ) + node_data. len ( ) )
751
+ u16:: try_from ( size_of :: < DevicePathHeader > ( ) + node_data. len ( ) )
752
752
. unwrap ( )
753
753
. to_le_bytes ( ) ,
754
754
) ;
@@ -787,7 +787,7 @@ mod tests {
787
787
assert_eq ! ( node. sub_type( ) . 0 , sub_type) ;
788
788
assert_eq ! (
789
789
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( )
791
791
) ;
792
792
assert_eq ! ( & node. data, node_data) ;
793
793
}
@@ -798,7 +798,7 @@ mod tests {
798
798
let dp = unsafe { DevicePath :: from_ffi_ptr ( raw_data. as_ptr ( ) . cast ( ) ) } ;
799
799
800
800
// 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 ) ;
802
802
803
803
// Check the list's node iter.
804
804
let nodes: Vec < _ > = dp. node_iter ( ) . collect ( ) ;
@@ -824,7 +824,7 @@ mod tests {
824
824
// Check the list's instance iter.
825
825
let mut iter = dp. instance_iter ( ) ;
826
826
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 ) ;
828
828
829
829
// Check the first instance's node iter.
830
830
let nodes: Vec < _ > = instance. node_iter ( ) . collect ( ) ;
@@ -835,7 +835,7 @@ mod tests {
835
835
836
836
// Check second instance.
837
837
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 ) ;
839
839
840
840
let nodes: Vec < _ > = instance. node_iter ( ) . collect ( ) ;
841
841
check_node ( nodes[ 0 ] , 0xa2 , 0xb2 , & [ 30 , 31 ] ) ;
@@ -876,15 +876,15 @@ mod tests {
876
876
// Raw data is long enough to hold a [`DevicePathNode`].
877
877
raw_data. push ( node[ 1 ] ) ;
878
878
raw_data. extend (
879
- u16:: try_from ( mem :: size_of :: < DevicePathHeader > ( ) + node_data. len ( ) )
879
+ u16:: try_from ( size_of :: < DevicePathHeader > ( ) + node_data. len ( ) )
880
880
. unwrap ( )
881
881
. to_le_bytes ( ) ,
882
882
) ;
883
883
raw_data. extend ( node_data) ;
884
884
let dp = <& DevicePathNode >:: try_from ( raw_data. as_slice ( ) ) . unwrap ( ) ;
885
885
886
886
// 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 ) ;
888
888
check_node ( dp, 0xa0 , 0xb0 , & [ 10 , 11 ] ) ;
889
889
890
890
// [`DevicePathNode`] data length exceeds the raw_data slice.
@@ -898,7 +898,7 @@ mod tests {
898
898
let dp = <& DevicePath >:: try_from ( raw_data. as_slice ( ) ) . unwrap ( ) ;
899
899
900
900
// 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 ) ;
902
902
903
903
// Check the list's node iter.
904
904
let nodes: Vec < _ > = dp. node_iter ( ) . collect ( ) ;
0 commit comments