Add impl_from! macro to shorten up error code

This commit is contained in:
Lucien Greathouse
2019-01-15 13:08:02 -08:00
parent 9d3638fa46
commit aae1d8b34f
6 changed files with 41 additions and 56 deletions

View File

@@ -26,11 +26,9 @@ pub enum ServeError {
ProjectLoadError(#[fail(cause)] ProjectLoadFuzzyError),
}
impl From<ProjectLoadFuzzyError> for ServeError {
fn from(error: ProjectLoadFuzzyError) -> ServeError {
ServeError::ProjectLoadError(error)
}
}
impl_from!(ServeError {
ProjectLoadFuzzyError => ProjectLoadError,
});
pub fn serve(options: &ServeOptions) -> Result<(), ServeError> {
info!("Looking for project at {}", options.fuzzy_project_path.display());