Skip to content

Commit

Permalink
Dissolve fn notmain into fn main
Browse files Browse the repository at this point in the history
  • Loading branch information
Urhengulas committed Apr 1, 2021
1 parent 3e43bab commit 83d752d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ const LINKER: &str = "rust-lld";
const SP_ALIGN: u64 = 8;

fn main() -> anyhow::Result<()> {
notmain().map(|code| process::exit(code))
}

fn notmain() -> anyhow::Result<i32> {
env_logger::init();

// NOTE `skip` the name/path of the binary (first argument)
Expand All @@ -33,7 +29,7 @@ fn notmain() -> anyhow::Result<i32> {
log::trace!("{:?}", c1);
let status = c1.status()?;
if !status.success() {
return Ok(status.code().unwrap_or(EXIT_CODE_FAILURE));
process::exit(status.code().unwrap_or(EXIT_CODE_FAILURE));
}

// if linking succeeds then linker scripts are well-formed; we'll rely on that in the parser
Expand Down Expand Up @@ -118,10 +114,10 @@ fn notmain() -> anyhow::Result<i32> {
log::trace!("{:?}", c2);
let status = c2.status()?;
if !status.success() {
return Ok(status.code().unwrap_or(EXIT_CODE_FAILURE));
process::exit(status.code().unwrap_or(EXIT_CODE_FAILURE));
}

Ok(0)
Ok(())
}

/// Returns `(used_ram_length, used_ram_align)`
Expand Down

0 comments on commit 83d752d

Please sign in to comment.