From a8fba09955708e5e0a1ea16f87da2a21c9b71f60 Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Sat, 4 Jul 2020 20:44:30 -0400 Subject: [PATCH] remove lint ignore on BunBunError --- src/error.rs | 29 ++++++++++++++--------------- src/routes.rs | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/error.rs b/src/error.rs index 3ddb443..50a8fd3 100644 --- a/src/error.rs +++ b/src/error.rs @@ -2,13 +2,12 @@ use std::error::Error; use std::fmt; #[derive(Debug)] -#[allow(clippy::enum_variant_names)] pub enum BunBunError { - IoError(std::io::Error), - ParseError(serde_yaml::Error), - WatchError(hotwatch::Error), - LoggerInitError(log::SetLoggerError), - CustomProgramError(String), + Io(std::io::Error), + Parse(serde_yaml::Error), + Watch(hotwatch::Error), + LoggerInit(log::SetLoggerError), + CustomProgram(String), NoValidConfigPath, InvalidConfigPath(std::path::PathBuf, std::io::Error), } @@ -18,11 +17,11 @@ impl Error for BunBunError {} impl fmt::Display for BunBunError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - Self::IoError(e) => e.fmt(f), - Self::ParseError(e) => e.fmt(f), - Self::WatchError(e) => e.fmt(f), - Self::LoggerInitError(e) => e.fmt(f), - Self::CustomProgramError(msg) => write!(f, "{}", msg), + Self::Io(e) => e.fmt(f), + Self::Parse(e) => e.fmt(f), + Self::Watch(e) => e.fmt(f), + Self::LoggerInit(e) => e.fmt(f), + Self::CustomProgram(msg) => write!(f, "{}", msg), Self::NoValidConfigPath => write!(f, "No valid config path was found!"), Self::InvalidConfigPath(path, reason) => { write!(f, "Failed to access {:?}: {}", path, reason) @@ -43,7 +42,7 @@ macro_rules! from_error { }; } -from_error!(std::io::Error, IoError); -from_error!(serde_yaml::Error, ParseError); -from_error!(hotwatch::Error, WatchError); -from_error!(log::SetLoggerError, LoggerInitError); +from_error!(std::io::Error, Io); +from_error!(serde_yaml::Error, Parse); +from_error!(hotwatch::Error, Watch); +from_error!(log::SetLoggerError, LoggerInit); diff --git a/src/routes.rs b/src/routes.rs index 1f8221a..d6b053a 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -189,7 +189,7 @@ fn resolve_path(path: PathBuf, args: &str) -> Result, BunBunError> { path.display(), ); let error = String::from_utf8_lossy(&output.stderr); - Err(BunBunError::CustomProgramError(error.to_string())) + Err(BunBunError::CustomProgram(error.to_string())) } }