Implement Default for ColorOptions

This commit is contained in:
Danilo Bargen 2021-10-17 19:56:40 +02:00
commit 6d77483ad5
3 changed files with 8 additions and 2 deletions

View file

@ -85,7 +85,7 @@ impl Default for RawStyle {
italic: false,
}
}
} // impl RawStyle
}
impl From<RawStyle> for Style {
fn from(raw_style: RawStyle) -> Self {

View file

@ -385,7 +385,7 @@ fn main() {
#[cfg(not(target_os = "windows"))]
let ansi_support = true;
let enable_styles = match args.color.unwrap_or(ColorOptions::Auto) {
let enable_styles = match args.color.unwrap_or_default() {
// Attempt to use styling if instructed
ColorOptions::Always => true,
// Enable styling if:

View file

@ -66,6 +66,12 @@ impl str::FromStr for ColorOptions {
}
}
impl Default for ColorOptions {
fn default() -> Self {
Self::Auto
}
}
#[derive(Debug, Eq, PartialEq)]
pub enum LineType {
Empty,