From 33633a5e1494828a53f17624bddb3fe402d0cadc Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Wed, 11 Feb 2015 10:54:23 -0800 Subject: [PATCH] Get everything to compile and fix some warnings --- serde2/benches/bench_log.rs | 6 ++---- serde2/src/de.rs | 9 +++++++-- serde2/src/json/error.rs | 2 +- serde2/src/lib.rs | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/serde2/benches/bench_log.rs b/serde2/benches/bench_log.rs index ecd10a51..9364b227 100644 --- a/serde2/benches/bench_log.rs +++ b/serde2/benches/bench_log.rs @@ -1,8 +1,6 @@ -#![feature(plugin, io)] +#![feature(collections, core, io, plugin, test)] #![allow(non_camel_case_types)] - -#[plugin] -extern crate serde2_macros; +#![plugin(serde2_macros)] extern crate serde2; extern crate "rustc-serialize" as rustc_serialize; diff --git a/serde2/src/de.rs b/serde2/src/de.rs index 62aa048c..3c0cb4f7 100644 --- a/serde2/src/de.rs +++ b/serde2/src/de.rs @@ -728,12 +728,17 @@ mod tests { enum Error { SyntaxError, EndOfStreamError, + MissingFieldError(&'static str), } impl super::Error for Error { fn syntax_error() -> Error { Error::SyntaxError } fn end_of_stream_error() -> Error { Error::EndOfStreamError } + + fn missing_field_error(field: &'static str) -> Error { + Error::MissingFieldError(field) + } } impl<'a> Deserializer for TokenDeserializer<'a> { @@ -1183,11 +1188,11 @@ mod tests { fn visit_enum< V: super::EnumVisitor, - >(&mut self, name: &str, variant: &str, mut visitor: V) -> Result { + >(&mut self, name: &str, variant: &str, visitor: V) -> Result { if name == "Enum" { self.visit_variant(variant, visitor) } else { - Err(super::Error::syntax_error()); + Err(super::Error::syntax_error()) } } diff --git a/serde2/src/json/error.rs b/serde2/src/json/error.rs index 6f1b6497..5cbec0f3 100644 --- a/serde2/src/json/error.rs +++ b/serde2/src/json/error.rs @@ -95,7 +95,7 @@ impl error::Error for Error { fn description(&self) -> &str { match *self { Error::SyntaxError(..) => "syntax error", - Error::IoError(ref error) => error.description().as_slice(), + Error::IoError(ref error) => error.description(), /* Error::ExpectedError(ref expected, _) => &expected, */ diff --git a/serde2/src/lib.rs b/serde2/src/lib.rs index d8cbf30f..59db3601 100644 --- a/serde2/src/lib.rs +++ b/serde2/src/lib.rs @@ -1,4 +1,4 @@ -#![feature(io)] +#![feature(core, io, std_misc, unicode)] extern crate unicode;