mirror of
https://github.com/serde-rs/json.git
synced 2025-10-02 15:26:00 +00:00
Remove unused Simple io error variant
This commit is contained in:
parent
f063631c0a
commit
5741cfb44a
@ -10,24 +10,11 @@ pub enum ErrorKind {
|
|||||||
UnexpectedEof,
|
UnexpectedEof,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ErrorKind {
|
|
||||||
#[inline]
|
|
||||||
fn as_str(&self) -> &'static str {
|
|
||||||
match self {
|
|
||||||
ErrorKind::InvalidData => "invalid data",
|
|
||||||
ErrorKind::WriteZero => "write zero",
|
|
||||||
ErrorKind::Other => "other os error",
|
|
||||||
ErrorKind::UnexpectedEof => "unexpected end of file",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Error {
|
pub struct Error {
|
||||||
repr: Repr,
|
repr: Repr,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Repr {
|
enum Repr {
|
||||||
Simple(ErrorKind),
|
|
||||||
Custom(ErrorKind, Box<dyn Display + Send + Sync>),
|
Custom(ErrorKind, Box<dyn Display + Send + Sync>),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +22,6 @@ impl Display for Error {
|
|||||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match &self.repr {
|
match &self.repr {
|
||||||
Repr::Custom(_, msg) => write!(fmt, "{}", msg),
|
Repr::Custom(_, msg) => write!(fmt, "{}", msg),
|
||||||
Repr::Simple(kind) => write!(fmt, "{}", kind.as_str()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,15 +34,6 @@ impl Debug for Error {
|
|||||||
|
|
||||||
impl serde::de::StdError for Error {}
|
impl serde::de::StdError for Error {}
|
||||||
|
|
||||||
impl From<ErrorKind> for Error {
|
|
||||||
#[inline]
|
|
||||||
fn from(kind: ErrorKind) -> Error {
|
|
||||||
Error {
|
|
||||||
repr: Repr::Simple(kind),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Error {
|
impl Error {
|
||||||
pub(crate) fn new<E>(kind: ErrorKind, error: E) -> Error
|
pub(crate) fn new<E>(kind: ErrorKind, error: E) -> Error
|
||||||
where
|
where
|
||||||
|
Loading…
x
Reference in New Issue
Block a user