use from attr of thiserror proc macro
@@ -22,10 +22,10 @@ pub enum CliError {
Unknown(String),
#[error("IO error: {0}")]
- Io(io::Error),
+ Io(#[from] io::Error),
#[error("Script error: {0}")]
- Script(run_script::ScriptError),
+ Script(#[from] run_script::ScriptError),
#[error("Http error: {0}")]
Http(Box<ureq::Error>),
@@ -34,18 +34,6 @@ pub enum CliError {
Serde(Box<serde_json::Error>),
}
-impl From<io::Error> for CliError {
- fn from(err: io::Error) -> CliError {
- CliError::Io(err)
- }
-}
-
-impl From<run_script::ScriptError> for CliError {
- fn from(err: run_script::ScriptError) -> CliError {
- CliError::Script(err)
- }
-}
-
impl From<ureq::Error> for CliError {
fn from(err: ureq::Error) -> CliError {
CliError::Http(Box::new(err))
