netstack: Remove a bunch of dead code

This commit is contained in:
bjorn3
2025-06-28 16:21:16 +02:00
parent 2f51590d9f
commit c9806f68fc
-22
View File
@@ -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<String>) -> std::result::Result<Self::T, Error>;
}
impl<T> ResultExt for std::result::Result<T, SyscallError> {
type T = T;
fn context(self, ctxt: impl Into<String>) -> std::result::Result<T, Error> {
self.map_err(|err| Error::from_syscall_error(err, ctxt))
}
}
impl Error {
pub fn from_syscall_error<S: Into<String>>(syscall_error: SyscallError, descr: S) -> Error {
Error {
@@ -42,13 +30,6 @@ impl Error {
descr: descr.into(),
}
}
pub fn other_error<S: Into<String>>(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)
}
}
}
}