remove lint ignore on BunBunError

This commit is contained in:
Edward Shen 2020-07-04 20:44:30 -04:00
parent ed462ba67e
commit a8fba09955
Signed by: edward
GPG key ID: 19182661E818369F
2 changed files with 15 additions and 16 deletions

View file

@ -2,13 +2,12 @@ use std::error::Error;
use std::fmt; use std::fmt;
#[derive(Debug)] #[derive(Debug)]
#[allow(clippy::enum_variant_names)]
pub enum BunBunError { pub enum BunBunError {
IoError(std::io::Error), Io(std::io::Error),
ParseError(serde_yaml::Error), Parse(serde_yaml::Error),
WatchError(hotwatch::Error), Watch(hotwatch::Error),
LoggerInitError(log::SetLoggerError), LoggerInit(log::SetLoggerError),
CustomProgramError(String), CustomProgram(String),
NoValidConfigPath, NoValidConfigPath,
InvalidConfigPath(std::path::PathBuf, std::io::Error), InvalidConfigPath(std::path::PathBuf, std::io::Error),
} }
@ -18,11 +17,11 @@ impl Error for BunBunError {}
impl fmt::Display for BunBunError { impl fmt::Display for BunBunError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self { match self {
Self::IoError(e) => e.fmt(f), Self::Io(e) => e.fmt(f),
Self::ParseError(e) => e.fmt(f), Self::Parse(e) => e.fmt(f),
Self::WatchError(e) => e.fmt(f), Self::Watch(e) => e.fmt(f),
Self::LoggerInitError(e) => e.fmt(f), Self::LoggerInit(e) => e.fmt(f),
Self::CustomProgramError(msg) => write!(f, "{}", msg), Self::CustomProgram(msg) => write!(f, "{}", msg),
Self::NoValidConfigPath => write!(f, "No valid config path was found!"), Self::NoValidConfigPath => write!(f, "No valid config path was found!"),
Self::InvalidConfigPath(path, reason) => { Self::InvalidConfigPath(path, reason) => {
write!(f, "Failed to access {:?}: {}", 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!(std::io::Error, Io);
from_error!(serde_yaml::Error, ParseError); from_error!(serde_yaml::Error, Parse);
from_error!(hotwatch::Error, WatchError); from_error!(hotwatch::Error, Watch);
from_error!(log::SetLoggerError, LoggerInitError); from_error!(log::SetLoggerError, LoggerInit);

View file

@ -189,7 +189,7 @@ fn resolve_path(path: PathBuf, args: &str) -> Result<Vec<u8>, BunBunError> {
path.display(), path.display(),
); );
let error = String::from_utf8_lossy(&output.stderr); let error = String::from_utf8_lossy(&output.stderr);
Err(BunBunError::CustomProgramError(error.to_string())) Err(BunBunError::CustomProgram(error.to_string()))
} }
} }