match-to-if-let

This commit is contained in:
Benjamin Sago 2017-08-12 22:51:45 +01:00
parent da00e2fda2
commit 33e83accd0

View File

@ -95,10 +95,14 @@ impl Mode {
if matches.has(&flags::LONG)? {
let details = long()?;
if matches.has(&flags::GRID)? {
match other_options_scan()? {
Mode::Grid(grid) => return Ok(Mode::GridDetails(grid_details::Options { grid, details, row_threshold: Some(5) })),
others => return Ok(others),
};
let other_options_mode = other_options_scan()?;
if let Mode::Grid(grid) = other_options_mode {
let row_threshold = Some(5);
return Ok(Mode::GridDetails(grid_details::Options { grid, details, row_threshold }));
}
else {
return Ok(other_options_mode);
}
}
else {
return Ok(Mode::Details(details));