about summary refs log tree commit diff
path: root/src/libserialize
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2014-12-18 06:39:01 -0800
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2014-12-18 06:56:34 -0800
commit11d9175a90b90bfe019b34d1a98a6edceda7a6b2 (patch)
treed6485acbc16bc0b8e18ae708cf09380ac763c1eb /src/libserialize
parentc0b2885ee12b79c99ac8245edb6eebaaa8e7fef1 (diff)
downloadrust-11d9175a90b90bfe019b34d1a98a6edceda7a6b2.tar.gz
rust-11d9175a90b90bfe019b34d1a98a6edceda7a6b2.zip
serialize: keep libserialize in sync with rustc-serialize to simplify merging
Diffstat (limited to 'src/libserialize')
-rw-r--r--src/libserialize/json.rs31
1 files changed, 3 insertions, 28 deletions
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index c811a16e2b1..25edf81f9df 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -2016,7 +2016,6 @@ macro_rules! read_primitive {
 
 impl ::Decoder<DecoderError> for Decoder {
     fn read_nil(&mut self) -> DecodeResult<()> {
-        debug!("read_nil");
         expect!(self.pop(), Null)
     }
 
@@ -2034,7 +2033,6 @@ impl ::Decoder<DecoderError> for Decoder {
     fn read_f32(&mut self) -> DecodeResult<f32> { self.read_f64().map(|x| x as f32) }
 
     fn read_f64(&mut self) -> DecodeResult<f64> {
-        debug!("read_f64");
         match self.pop() {
             Json::I64(f) => Ok(f as f64),
             Json::U64(f) => Ok(f as f64),
@@ -2053,7 +2051,6 @@ impl ::Decoder<DecoderError> for Decoder {
     }
 
     fn read_bool(&mut self) -> DecodeResult<bool> {
-        debug!("read_bool");
         expect!(self.pop(), Boolean)
     }
 
@@ -2071,14 +2068,12 @@ impl ::Decoder<DecoderError> for Decoder {
     }
 
     fn read_str(&mut self) -> DecodeResult<string::String> {
-        debug!("read_str");
         expect!(self.pop(), String)
     }
 
     fn read_enum<T, F>(&mut self, name: &str, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
-        debug!("read_enum({})", name);
         f(self)
     }
 
@@ -2086,7 +2081,6 @@ impl ::Decoder<DecoderError> for Decoder {
                                mut f: F) -> DecodeResult<T>
         where F: FnMut(&mut Decoder, uint) -> DecodeResult<T>,
     {
-        debug!("read_enum_variant(names={})", names);
         let name = match self.pop() {
             Json::String(s) => s,
             Json::Object(mut o) => {
@@ -2129,14 +2123,12 @@ impl ::Decoder<DecoderError> for Decoder {
     fn read_enum_variant_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
-        debug!("read_enum_variant_arg(idx={})", idx);
         f(self)
     }
 
     fn read_enum_struct_variant<T, F>(&mut self, names: &[&str], f: F) -> DecodeResult<T> where
         F: FnMut(&mut Decoder, uint) -> DecodeResult<T>,
     {
-        debug!("read_enum_struct_variant(names={})", names);
         self.read_enum_variant(names, f)
     }
 
@@ -2148,14 +2140,12 @@ impl ::Decoder<DecoderError> for Decoder {
                                          -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
-        debug!("read_enum_struct_variant_field(name={}, idx={})", name, idx);
         self.read_enum_variant_arg(idx, f)
     }
 
     fn read_struct<T, F>(&mut self, name: &str, len: uint, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
-        debug!("read_struct(name={}, len={})", name, len);
         let value = try!(f(self));
         self.pop();
         Ok(value)
@@ -2168,7 +2158,6 @@ impl ::Decoder<DecoderError> for Decoder {
                                -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
-        debug!("read_struct_field(name={}, idx={})", name, idx);
         let mut obj = try!(expect!(self.pop(), Object));
 
         let value = match obj.remove(&name.to_string()) {
@@ -2193,7 +2182,6 @@ impl ::Decoder<DecoderError> for Decoder {
     fn read_tuple<T, F>(&mut self, tuple_len: uint, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
-        debug!("read_tuple()");
         self.read_seq(move |d, len| {
             if len == tuple_len {
                 f(d)
@@ -2206,7 +2194,6 @@ impl ::Decoder<DecoderError> for Decoder {
     fn read_tuple_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
-        debug!("read_tuple_arg(idx={})", idx);
         self.read_seq_elt(idx, f)
     }
 
@@ -2217,7 +2204,6 @@ impl ::Decoder<DecoderError> for Decoder {
                                -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
-        debug!("read_tuple_struct(name={})", name);
         self.read_tuple(len, f)
     }
 
@@ -2227,14 +2213,12 @@ impl ::Decoder<DecoderError> for Decoder {
                                    -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
-        debug!("read_tuple_struct_arg(idx={})", idx);
         self.read_tuple_arg(idx, f)
     }
 
     fn read_option<T, F>(&mut self, mut f: F) -> DecodeResult<T> where
         F: FnMut(&mut Decoder, bool) -> DecodeResult<T>,
     {
-        debug!("read_option()");
         match self.pop() {
             Json::Null => f(self, false),
             value => { self.stack.push(value); f(self, true) }
@@ -2244,7 +2228,6 @@ impl ::Decoder<DecoderError> for Decoder {
     fn read_seq<T, F>(&mut self, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder, uint) -> DecodeResult<T>,
     {
-        debug!("read_seq()");
         let array = try!(expect!(self.pop(), Array));
         let len = array.len();
         for v in array.into_iter().rev() {
@@ -2256,14 +2239,12 @@ impl ::Decoder<DecoderError> for Decoder {
     fn read_seq_elt<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
-        debug!("read_seq_elt(idx={})", idx);
         f(self)
     }
 
     fn read_map<T, F>(&mut self, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder, uint) -> DecodeResult<T>,
     {
-        debug!("read_map()");
         let obj = try!(expect!(self.pop(), Object));
         let len = obj.len();
         for (key, value) in obj.into_iter() {
@@ -2276,14 +2257,12 @@ impl ::Decoder<DecoderError> for Decoder {
     fn read_map_elt_key<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
        F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
-        debug!("read_map_elt_key(idx={})", idx);
         f(self)
     }
 
     fn read_map_elt_val<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
        F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
-        debug!("read_map_elt_val(idx={})", idx);
         f(self)
     }
 
@@ -2445,9 +2424,7 @@ mod tests {
     use super::ParserError::*;
     use super::DecoderError::*;
     use super::JsonEvent::*;
-    use super::ParserState::*;
     use super::StackElement::*;
-    use super::InternalStackElement::*;
     use super::{PrettyEncoder, Json, from_str, DecodeResult, DecoderError, JsonEvent, Parser,
                 StackElement, Stack, Encoder, Decoder};
     use std::{i64, u64, f32, f64, io};
@@ -2682,8 +2659,6 @@ mod tests {
     }
 
     fn with_str_writer<F>(f: F) -> string::String where F: FnOnce(&mut io::Writer){
-        use std::str;
-
         let mut m = Vec::new();
         f(&mut m as &mut io::Writer);
         string::String::from_utf8(m).unwrap()
@@ -2760,9 +2735,9 @@ mod tests {
     fn test_write_char() {
         check_encoder_for_simple!('a', "\"a\"");
         check_encoder_for_simple!('\t', "\"\\t\"");
-        check_encoder_for_simple!('\u00a0', "\"\u00a0\"");
-        check_encoder_for_simple!('\uabcd', "\"\uabcd\"");
-        check_encoder_for_simple!('\U0010ffff', "\"\U0010ffff\"");
+        check_encoder_for_simple!('\u{00a0}', "\"\u{00a0}\"");
+        check_encoder_for_simple!('\u{abcd}', "\"\u{abcd}\"");
+        check_encoder_for_simple!('\u{10ffff}', "\"\u{10ffff}\"");
     }
 
     #[test]