Skip to content

Commit

Permalink
Merge pull request #1202 from andre-braga/idiom
Browse files Browse the repository at this point in the history
uefi: make DevicePathHeader::try_from idiomatic
  • Loading branch information
nicholasbishop committed Jun 11, 2024
2 parents ed28e51 + faf56c7 commit 34e52a1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions uefi/src/proto/device_path/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,10 @@ impl<'a> TryFrom<&[u8]> for &'a DevicePathHeader {

fn try_from(bytes: &[u8]) -> Result<Self, Self::Error> {
if mem::size_of::<DevicePathHeader>() <= bytes.len() {
unsafe {
return Ok(&*bytes.as_ptr().cast::<DevicePathHeader>());
}
unsafe { Ok(&*bytes.as_ptr().cast::<DevicePathHeader>()) }
} else {
Err(ByteConversionError::InvalidLength)
}
Err(ByteConversionError::InvalidLength)
}
}

Expand Down

0 comments on commit 34e52a1

Please sign in to comment.