Collapse down similar branches of match-statement

This commit is contained in:
Daniel Lockyer 2017-03-31 17:11:49 +01:00
parent 91459d608c
commit ec84f16da7
2 changed files with 11 additions and 12 deletions

View File

@ -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,
}
}
}

View File

@ -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,
}
}