diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs index e6c22788..c54726bd 100644 --- a/serde/src/de/mod.rs +++ b/serde/src/de/mod.rs @@ -40,7 +40,7 @@ pub trait Error: Sized + error::Error { /// `Type` represents all the primitive types that can be deserialized. This is used by /// `Error::kind_mismatch`. -#[derive(Clone, PartialEq, Eq, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum Type { /// Represents a `bool` type. Bool, diff --git a/serde/src/de/value.rs b/serde/src/de/value.rs index 8b5c3196..3f40f39e 100644 --- a/serde/src/de/value.rs +++ b/serde/src/de/value.rs @@ -55,10 +55,12 @@ impl de::Error for Error { impl fmt::Display for Error { fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - Error::SyntaxError => formatter.write_str("SyntaxError"), - Error::EndOfStreamError => formatter.write_str("EndOfStreamError"), - Error::UnknownFieldError(ref field) => formatter.write_str(format!("Unknown field: {}", field).as_ref()), - Error::MissingFieldError(ref field) => formatter.write_str(format!("Missing field: {}", field).as_ref()), + Error::Syntax(ref s) => write!(formatter, "Syntax error: {}", s), + Error::Type(ty) => write!(formatter, "Invalid type: {:?}", ty), + Error::Length(len) => write!(formatter, "Invalid length: {}", len), + Error::EndOfStream => formatter.write_str("EndOfStreamError"), + Error::UnknownField(ref field) => write!(formatter, "Unknown field: {}", field), + Error::MissingField(ref field) => write!(formatter, "Missing field: {}", field), } } }