Skip to content

Commit bc3a0a4

Browse files
committed
Minor changes for readability
1 parent 9e9598c commit bc3a0a4

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/man.rs

+12-14
Original file line numberDiff line numberDiff line change
@@ -360,26 +360,24 @@ fn exit_status(page: Roff, exit_statuses: &[ExitStatus]) -> Roff {
360360
if exit_statuses.is_empty() {
361361
return page;
362362
}
363-
let arr = if exit_statuses
364-
.iter()
365-
.any(|status| status.use_default_instead)
366-
{
363+
let should_use_default = exit_statuses.iter().any(|s| s.use_default_instead);
364+
let arr = if should_use_default {
367365
vec![
368366
list(&[bold("0")], &["Successful program execution.\n\n"]),
369367
list(&[bold("1")], &["Unsuccessful program execution.\n\n"]),
370368
list(&[bold("101")], &["The program panicked."]),
371369
]
372370
} else {
373-
let mut arr = vec![];
374-
for exit_status in exit_statuses {
375-
let exit_code =
376-
format!("{}", exit_status.code.expect("initialized with value"));
377-
let mut exit_description =
378-
String::from(exit_status.description.unwrap_or(""));
379-
exit_description.push_str("\n\n");
380-
arr.push(list(&[bold(&exit_code)], &[exit_description]));
381-
}
382-
arr
371+
exit_statuses
372+
.into_iter()
373+
.map(|status| {
374+
let code =
375+
format!("{}", status.code.expect("initialized with a value"));
376+
let mut description = String::from(status.description.unwrap_or(""));
377+
description.push_str("\n\n");
378+
list(&[bold(&code)], &[description])
379+
})
380+
.collect()
383381
};
384382
page.section("EXIT STATUS", &arr)
385383
}

0 commit comments

Comments
 (0)