diff --git a/netstack/src/error.rs b/netstack/src/error.rs index 8487c4ab19..6a0e14928f 100644 --- a/netstack/src/error.rs +++ b/netstack/src/error.rs @@ -8,7 +8,6 @@ use syscall::error::Error as SyscallError; enum ErrorType { Syscall(SyscallError), IOError(IOError), - Other, } #[derive(Debug)] @@ -17,17 +16,6 @@ pub struct Error { descr: String, } -pub trait ResultExt { - type T; - fn context(self, ctxt: impl Into) -> std::result::Result; -} -impl ResultExt for std::result::Result { - type T = T; - fn context(self, ctxt: impl Into) -> std::result::Result { - self.map_err(|err| Error::from_syscall_error(err, ctxt)) - } -} - impl Error { pub fn from_syscall_error>(syscall_error: SyscallError, descr: S) -> Error { Error { @@ -42,13 +30,6 @@ impl Error { descr: descr.into(), } } - - pub fn other_error>(descr: S) -> Error { - Error { - error_type: ErrorType::Other, - descr: descr.into(), - } - } } impl fmt::Display for Error { @@ -60,9 +41,6 @@ impl fmt::Display for Error { ErrorType::IOError(ref io_error) => { write!(f, "{} : io error : {}", self.descr, io_error) } - ErrorType::Other => { - write!(f, "{}", self.descr) - } } } }