From 49bd7e8e49655da83d64969a54c6281bd6c6d2fe Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 18 Dec 2024 09:23:16 +0100 Subject: Remove From from errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Having a From came from a hacky beginning in which std::io::Error was being abused. Now the error handling is saner, so there's no more need for that. Signed-off-by: Miquel Sabaté Solà --- lib/xixanta/src/errors.rs | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'lib/xixanta/src/errors.rs') diff --git a/lib/xixanta/src/errors.rs b/lib/xixanta/src/errors.rs index 28eaec1..d64183d 100644 --- a/lib/xixanta/src/errors.rs +++ b/lib/xixanta/src/errors.rs @@ -25,15 +25,6 @@ pub struct ParseError { impl std::error::Error for ParseError {} -impl From for ParseError { - fn from(err: std::io::Error) -> Self { - ParseError { - line: 0, - message: err.to_string(), - } - } -} - impl fmt::Display for ParseError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "parser (line {}): {}.", self.line + 1, self.message) @@ -58,17 +49,6 @@ pub struct ContextError { impl std::error::Error for ContextError {} -// TODO: needed? -impl From for ContextError { - fn from(err: std::io::Error) -> Self { - ContextError { - line: 0, - reason: ContextErrorReason::Other, - message: err.to_string(), - } - } -} - impl fmt::Display for ContextError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( @@ -89,16 +69,6 @@ pub struct EvalError { impl std::error::Error for EvalError {} -impl From for EvalError { - fn from(err: std::io::Error) -> Self { - EvalError { - line: 0, - message: err.to_string(), - global: true, - } - } -} - impl From for EvalError { fn from(err: ContextError) -> Self { EvalError { -- cgit v1.2.3