Skip to content

Commit

Permalink
Minor changes for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
codesections committed Jan 22, 2019
1 parent 9e9598c commit a09fcd7
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/man.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,26 +360,24 @@ fn exit_status(page: Roff, exit_statuses: &[ExitStatus]) -> Roff {
if exit_statuses.is_empty() {
return page;
}
let arr = if exit_statuses
.iter()
.any(|status| status.use_default_instead)
{
let should_use_default = exit_statuses.iter().any(|s| s.use_default_instead);
let arr = if should_use_default {
vec![
list(&[bold("0")], &["Successful program execution.\n\n"]),
list(&[bold("1")], &["Unsuccessful program execution.\n\n"]),
list(&[bold("101")], &["The program panicked."]),
]
} else {
let mut arr = vec![];
for exit_status in exit_statuses {
let exit_code =
format!("{}", exit_status.code.expect("initialized with value"));
let mut exit_description =
String::from(exit_status.description.unwrap_or(""));
exit_description.push_str("\n\n");
arr.push(list(&[bold(&exit_code)], &[exit_description]));
}
arr
exit_statuses
.iter()
.map(|status| {
let code =
format!("{}", status.code.expect("initialized with a value"));
let mut description = String::from(status.description.unwrap_or(""));
description.push_str("\n\n");
list(&[bold(&code)], &[description])
})
.collect()
};
page.section("EXIT STATUS", &arr)
}
Expand Down

0 comments on commit a09fcd7

Please sign in to comment.