diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2022-04-29 00:37:33 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2022-04-29 00:37:33 +0200 |
commit | b49cf79661bba3c546be419a61b15756065c5a0a (patch) | |
tree | f1667c5784d090addd50af1fb032045cc6925e53 /src | |
parent | 1c4c87128ab5306baed92e90ae9a49fc7f720bcd (diff) | |
download | elfload-b49cf79661bba3c546be419a61b15756065c5a0a.tar.gz elfload-b49cf79661bba3c546be419a61b15756065c5a0a.zip |
minor cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -289,20 +289,20 @@ impl<const N: usize> Elf<'_, N> { let w = (flags & PF_W) != 0; let r = (flags & PF_R) != 0; - load_segments_slice = if let Some((slot, rest)) = load_segments_slice.split_first_mut() - { - *slot = Some(LoadSegment { - vaddr, - bytes, - zero_pad: memsz - filesz, - x, - w, - r, - }); - rest - } else { - return Err(Error::OutOfLoadSegments); - }; + load_segments_slice = load_segments_slice + .split_first_mut() + .map(|(slot, rest)| { + *slot = Some(LoadSegment { + vaddr, + bytes, + zero_pad: memsz - filesz, + x, + w, + r, + }); + rest + }) + .ok_or(Error::OutOfLoadSegments)?; } Ok(Elf { |