From bbc167cde968aa2ad10e97f1223b8d6ff6eaf47f Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Wed, 12 Aug 2015 23:01:49 -0700 Subject: [PATCH] Get serde feature compiling again --- src/decoder/serde.rs | 18 +++++++++--------- tests/serde.rs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/decoder/serde.rs b/src/decoder/serde.rs index b12984d..01806d4 100644 --- a/src/decoder/serde.rs +++ b/src/decoder/serde.rs @@ -12,8 +12,8 @@ struct MapVisitor<'a, I> { fn se2toml(err: de::value::Error, ty: &'static str) -> DecodeError { match err { - de::value::Error::SyntaxError => de::Error::syntax_error(), - de::value::Error::EndOfStreamError => de::Error::end_of_stream_error(), + de::value::Error::SyntaxError => de::Error::syntax(ty), + de::value::Error::EndOfStreamError => de::Error::end_of_stream(), de::value::Error::MissingFieldError(s) => { DecodeError { field: Some(s.to_string()), @@ -64,7 +64,7 @@ impl de::Deserializer for Decoder { value: None, }) } - None => Err(de::Error::end_of_stream_error()), + None => Err(de::Error::end_of_stream()), } } @@ -155,7 +155,7 @@ impl<'a, I> de::SeqVisitor for SeqDeserializer<'a, I> if self.len == 0 { Ok(()) } else { - Err(de::Error::end_of_stream_error()) + Err(de::Error::end_of_stream()) } } @@ -165,19 +165,19 @@ impl<'a, I> de::SeqVisitor for SeqDeserializer<'a, I> } impl de::Error for DecodeError { - fn syntax_error() -> DecodeError { + fn syntax(_: &str) -> DecodeError { DecodeError { field: None, kind: DecodeErrorKind::SyntaxError } } - fn end_of_stream_error() -> DecodeError { + fn end_of_stream() -> DecodeError { DecodeError { field: None, kind: DecodeErrorKind::EndOfStream } } - fn missing_field_error(name: &'static str) -> DecodeError { + fn missing_field(name: &'static str) -> DecodeError { DecodeError { field: Some(name.to_string()), kind: DecodeErrorKind::ExpectedField(None), } } - fn unknown_field_error(name: &str) -> DecodeError { + fn unknown_field(name: &str) -> DecodeError { DecodeError { field: Some(name.to_string()), kind: DecodeErrorKind::UnknownField, @@ -239,7 +239,7 @@ impl<'a, I> de::MapVisitor for MapVisitor<'a, I> } Ok(v) }, - None => Err(de::Error::end_of_stream_error()) + None => Err(de::Error::end_of_stream()) } } diff --git a/tests/serde.rs b/tests/serde.rs index 4c0cc96..f4af529 100644 --- a/tests/serde.rs +++ b/tests/serde.rs @@ -87,7 +87,7 @@ fn application_decode_error() { fn deserialize(d: &mut D) -> Result { let x: usize = try!(Deserialize::deserialize(d)); if x > 10 { - Err(serde::de::Error::syntax_error()) + Err(serde::de::Error::syntax("more than 10")) } else { Ok(Range10(x)) }