diff --git a/src/config.rs b/src/config.rs index 42d5311..cfa810c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -37,14 +37,14 @@ pub enum RawColor { impl From for Color { fn from(raw_color: RawColor) -> Self { match raw_color { - RawColor::Black => Color::Black, - RawColor::Red => Color::Red, - RawColor::Green => Color::Green, - RawColor::Yellow => Color::Yellow, - RawColor::Blue => Color::Blue, - RawColor::Purple => Color::Purple, - RawColor::Cyan => Color::Cyan, - RawColor::White => Color::White, + RawColor::Black => Self::Black, + RawColor::Red => Self::Red, + RawColor::Green => Self::Green, + RawColor::Yellow => Self::Yellow, + RawColor::Blue => Self::Blue, + RawColor::Purple => Self::Purple, + RawColor::Cyan => Self::Cyan, + RawColor::White => Self::White, } } } diff --git a/src/error.rs b/src/error.rs index 60e0756..805e339 100644 --- a/src/error.rs +++ b/src/error.rs @@ -11,16 +11,16 @@ pub enum TealdeerError { impl From for TealdeerError { fn from(err: ReqwestError) -> Self { - TealdeerError::UpdateError(format!("HTTP error: {}", err.to_string())) + Self::UpdateError(format!("HTTP error: {}", err.to_string())) } } impl fmt::Display for TealdeerError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - TealdeerError::CacheError(e) => write!(f, "CacheError: {}", e), - TealdeerError::ConfigError(e) => write!(f, "ConfigError: {}", e), - TealdeerError::UpdateError(e) => write!(f, "UpdateError: {}", e), + Self::CacheError(e) => write!(f, "CacheError: {}", e), + Self::ConfigError(e) => write!(f, "ConfigError: {}", e), + Self::UpdateError(e) => write!(f, "UpdateError: {}", e), } } } diff --git a/src/types.rs b/src/types.rs index f6caa23..380b770 100644 --- a/src/types.rs +++ b/src/types.rs @@ -18,11 +18,11 @@ pub enum OsType { impl fmt::Display for OsType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - OsType::Linux => write!(f, "Linux"), - OsType::OsX => write!(f, "macOS / BSD"), - OsType::SunOs => write!(f, "SunOS"), - OsType::Windows => write!(f, "Windows"), - OsType::Other => write!(f, "Unknown OS"), + Self::Linux => write!(f, "Linux"), + Self::OsX => write!(f, "macOS / BSD"), + Self::SunOs => write!(f, "SunOS"), + Self::Windows => write!(f, "Windows"), + Self::Other => write!(f, "Unknown OS"), } } } @@ -43,23 +43,23 @@ impl<'a> From<&'a str> for LineType { let trimmed: &str = line.trim_end(); let mut chars = trimmed.chars(); match chars.next() { - None => LineType::Empty, - Some('#') => LineType::Title( + None => Self::Empty, + Some('#') => Self::Title( trimmed .trim_start_matches(|chr: char| chr == '#' || chr.is_whitespace()) .into(), ), - Some('>') => LineType::Description( + Some('>') => Self::Description( trimmed .trim_start_matches(|chr: char| chr == '>' || chr.is_whitespace()) .into(), ), - Some(' ') => LineType::ExampleCode( + Some(' ') => Self::ExampleCode( trimmed .trim_start_matches(char::is_whitespace) .into(), ), - _ => LineType::ExampleText(trimmed.into()), + _ => Self::ExampleText(trimmed.into()), } } } @@ -71,28 +71,28 @@ impl LineType { let trimmed = line.trim(); let mut chars = trimmed.chars(); match chars.next() { - None => LineType::Empty, - Some('#') => LineType::Title( + None => Self::Empty, + Some('#') => Self::Title( trimmed .trim_start_matches(|chr: char| chr == '#' || chr.is_whitespace()) .into(), ), - Some('>') => LineType::Description( + Some('>') => Self::Description( trimmed .trim_start_matches(|chr: char| chr == '>' || chr.is_whitespace()) .into(), ), - Some('-') => LineType::ExampleText( + Some('-') => Self::ExampleText( trimmed .trim_start_matches(|chr: char| chr == '-' || chr.is_whitespace()) .into(), ), - Some('`') if chars.last() == Some('`') => LineType::ExampleCode( + Some('`') if chars.last() == Some('`') => Self::ExampleCode( trimmed .trim_matches(|chr: char| chr == '`' || chr.is_whitespace()) .into(), ), - _ => LineType::Other(trimmed.into()), + _ => Self::Other(trimmed.into()), } } }