From ec84f16da749ca24732e00b00f6f737e77e64973 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Fri, 31 Mar 2017 17:11:49 +0100 Subject: [PATCH] Collapse down similar branches of match-statement --- src/options/view.rs | 13 ++++++------- src/output/column.rs | 10 +++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/options/view.rs b/src/options/view.rs index 06f76ba..00fd82f 100644 --- a/src/options/view.rs +++ b/src/options/view.rs @@ -91,9 +91,9 @@ impl View { if let Some(&width) = term_width.as_ref() { let colours = match term_colours { - TerminalColours::Always => Colours::colourful(colour_scale()), + TerminalColours::Always + | TerminalColours::Automatic => Colours::colourful(colour_scale()), TerminalColours::Never => Colours::plain(), - TerminalColours::Automatic => Colours::colourful(colour_scale()), }; if matches.opt_present("oneline") { @@ -137,8 +137,7 @@ impl View { let colours = match term_colours { TerminalColours::Always => Colours::colourful(colour_scale()), - TerminalColours::Never => Colours::plain(), - TerminalColours::Automatic => Colours::plain(), + TerminalColours::Never | TerminalColours::Automatic => Colours::plain(), }; if matches.opt_present("tree") { @@ -221,9 +220,9 @@ impl TerminalWidth { fn as_ref(&self) -> Option<&usize> { match *self { - TerminalWidth::Set(ref width) => Some(width), - TerminalWidth::Terminal(ref width) => Some(width), - TerminalWidth::Unset => None, + TerminalWidth::Set(ref width) + | TerminalWidth::Terminal(ref width) => Some(width), + TerminalWidth::Unset => None, } } } diff --git a/src/output/column.rs b/src/output/column.rs index 04a6f31..36a8511 100644 --- a/src/output/column.rs +++ b/src/output/column.rs @@ -27,11 +27,11 @@ impl Column { /// Get the alignment this column should use. pub fn alignment(&self) -> Alignment { match *self { - Column::FileSize(_) => Alignment::Right, - Column::HardLinks => Alignment::Right, - Column::Inode => Alignment::Right, - Column::Blocks => Alignment::Right, - Column::GitStatus => Alignment::Right, + Column::FileSize(_) + | Column::HardLinks + | Column::Inode + | Column::Blocks + | Column::GitStatus => Alignment::Right, _ => Alignment::Left, } }