Skip to content

Commit 94946ca

Browse files
d-e-s-odanielocfb
authored andcommitted
Use ReadRaw::read_array() in Gsym parsing code
We don't have to use the ReadRaw::read_slice() method in conjunction with a fallible cast to read a compile-time-sized amount of bytes, but can use the ReadRaw::read_array() helper. Signed-off-by: Daniel Müller <deso@posteo.net>
1 parent fb567a3 commit 94946ca

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/gsym/parser.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ impl GsymContext<'_> {
101101
let num_addrs = data.read_u32()?;
102102
let strtab_offset = data.read_u32()?;
103103
let strtab_size = data.read_u32()?;
104-
// SANITY: We know that the slice has 20 elements if read
105-
// successful.
106-
let uuid = <[u8; 20]>::try_from(data.read_slice(20)?).unwrap();
104+
let uuid = data.read_array::<20>()?;
107105

108106
let addr_tab = data.read_slice(num_addrs as usize * usize::from(addr_off_size))?;
109107
let () = data.align(align_of::<u32>())?;

0 commit comments

Comments
 (0)