Skip to content

Commit

Permalink
Merge pull request #71 from toku-sa-n/use_result_map
Browse files Browse the repository at this point in the history
refactor: use `Result::map`
  • Loading branch information
nrc authored Jul 8, 2021
2 parents 033fea2 + b1070f6 commit 3f6df1d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ pub struct ElfFile<'a> {

impl<'a> ElfFile<'a> {
pub fn new(input: &'a [u8]) -> Result<ElfFile<'a>, &'static str> {
let header = header::parse_header(input)?;
Ok(ElfFile {
input,
header,
})
header::parse_header(input).map(|header| ElfFile {input, header})
}

pub fn section_header(&self, index: u16) -> Result<SectionHeader<'a>, &'static str> {
Expand Down

0 comments on commit 3f6df1d

Please sign in to comment.