-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from Bzomak/remove-thiserror
Remove thiserror crate
- Loading branch information
Showing
3 changed files
with
16 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
use thiserror; | ||
use std::fmt; | ||
|
||
pub type Result<T> = std::result::Result<T, Error>; | ||
|
||
#[derive(thiserror::Error, Copy, Clone, Eq, PartialEq, Debug)] | ||
#[derive(Copy, Clone, Eq, PartialEq, Debug)] | ||
pub enum Error { | ||
#[error("bad absolute path")] | ||
BadAbsolutePath, | ||
#[error("bad relative path")] | ||
BadRelativePath, | ||
#[error("cannot find binary path")] | ||
CannotFindBinaryPath, | ||
#[error("cannot get current directory")] | ||
CannotGetCurrentDir, | ||
#[error("cannot canonicalize path")] | ||
CannotCanonicalize, | ||
} | ||
|
||
impl std::error::Error for Error {} | ||
|
||
impl fmt::Display for Error { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
match self { | ||
Error::BadAbsolutePath => write!(f, "bad absolute path"), | ||
Error::BadRelativePath => write!(f, "bad relative path"), | ||
Error::CannotFindBinaryPath => write!(f, "cannot find binary path"), | ||
Error::CannotGetCurrentDir => write!(f, "cannot get current directory"), | ||
Error::CannotCanonicalize => write!(f, "cannot canonicalize path"), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ | |
extern crate either; | ||
extern crate libc; | ||
extern crate thiserror; | ||
|
||
mod checker; | ||
mod error; | ||
|