ソースを参照

match-to-if-let

Benjamin Sago 8 年 前
コミット
33e83accd0
1 ファイル変更8 行追加4 行削除
  1. 8 4
      src/options/view.rs

+ 8 - 4
src/options/view.rs

@@ -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));