Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
SanmerDev committed Jun 19, 2024
1 parent 8c7e2cf commit b928950
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 27 deletions.
29 changes: 12 additions & 17 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use core::fmt;
use core::fmt::{Debug, Display, Formatter};
use core::result;

pub type Result<T> = result::Result<T, Error>;
Expand All @@ -23,40 +24,34 @@ struct ErrorImpl {
msg: Box<str>,
}

impl fmt::Debug for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.err.fmt(f)
impl Display for ErrorImpl {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
f.write_str(&self.msg)
}
}

impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(self, f)
impl Debug for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "Error({:?})", self.err.to_string())
}
}

impl fmt::Debug for ErrorImpl {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.msg.fmt(f)
}
}

impl fmt::Display for ErrorImpl {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(&self, f)
impl Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
Display::fmt(&self.err, f)
}
}

impl serde::de::StdError for Error {}

impl serde::de::Error for Error {
fn custom<T: fmt::Display>(msg: T) -> Self {
fn custom<T: Display>(msg: T) -> Self {
Error::msg(msg.to_string())
}
}

impl serde::ser::Error for Error {
fn custom<T: fmt::Display>(msg: T) -> Self {
fn custom<T: Display>(msg: T) -> Self {
Error::msg(msg.to_string())
}
}
10 changes: 0 additions & 10 deletions src/io/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ use alloc::vec::Vec;
use core::fmt::{self, Display};
use core::result;

pub enum ErrorKind {
Other,
}

pub struct Error;

impl Display for Error {
Expand All @@ -14,12 +10,6 @@ impl Display for Error {
}
}

impl Error {
pub(crate) fn new(_kind: ErrorKind, _error: &'static str) -> Error {
Error
}
}

pub type Result<T> = result::Result<T, Error>;

pub trait Write {
Expand Down

0 comments on commit b928950

Please sign in to comment.