We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ed28e51 + faf56c7 commit 34e52a1Copy full SHA for 34e52a1
uefi/src/proto/device_path/mod.rs
@@ -124,11 +124,10 @@ impl<'a> TryFrom<&[u8]> for &'a DevicePathHeader {
124
125
fn try_from(bytes: &[u8]) -> Result<Self, Self::Error> {
126
if mem::size_of::<DevicePathHeader>() <= bytes.len() {
127
- unsafe {
128
- return Ok(&*bytes.as_ptr().cast::<DevicePathHeader>());
129
- }
+ unsafe { Ok(&*bytes.as_ptr().cast::<DevicePathHeader>()) }
+ } else {
+ Err(ByteConversionError::InvalidLength)
130
}
131
- Err(ByteConversionError::InvalidLength)
132
133
134
0 commit comments