@@ -2016,7 +2016,6 @@ macro_rules! read_primitive {
2016
2016
2017
2017
impl :: Decoder < DecoderError > for Decoder {
2018
2018
fn read_nil ( & mut self ) -> DecodeResult < ( ) > {
2019
- debug ! ( "read_nil" ) ;
2020
2019
expect ! ( self . pop( ) , Null )
2021
2020
}
2022
2021
@@ -2034,7 +2033,6 @@ impl ::Decoder<DecoderError> for Decoder {
2034
2033
fn read_f32 ( & mut self ) -> DecodeResult < f32 > { self . read_f64 ( ) . map ( |x| x as f32 ) }
2035
2034
2036
2035
fn read_f64 ( & mut self ) -> DecodeResult < f64 > {
2037
- debug ! ( "read_f64" ) ;
2038
2036
match self . pop ( ) {
2039
2037
Json :: I64 ( f) => Ok ( f as f64 ) ,
2040
2038
Json :: U64 ( f) => Ok ( f as f64 ) ,
@@ -2053,7 +2051,6 @@ impl ::Decoder<DecoderError> for Decoder {
2053
2051
}
2054
2052
2055
2053
fn read_bool ( & mut self ) -> DecodeResult < bool > {
2056
- debug ! ( "read_bool" ) ;
2057
2054
expect ! ( self . pop( ) , Boolean )
2058
2055
}
2059
2056
@@ -2071,22 +2068,19 @@ impl ::Decoder<DecoderError> for Decoder {
2071
2068
}
2072
2069
2073
2070
fn read_str ( & mut self ) -> DecodeResult < string:: String > {
2074
- debug ! ( "read_str" ) ;
2075
2071
expect ! ( self . pop( ) , String )
2076
2072
}
2077
2073
2078
2074
fn read_enum < T , F > ( & mut self , name : & str , f : F ) -> DecodeResult < T > where
2079
2075
F : FnOnce ( & mut Decoder ) -> DecodeResult < T > ,
2080
2076
{
2081
- debug ! ( "read_enum({})" , name) ;
2082
2077
f ( self )
2083
2078
}
2084
2079
2085
2080
fn read_enum_variant < T , F > ( & mut self , names : & [ & str ] ,
2086
2081
mut f : F ) -> DecodeResult < T >
2087
2082
where F : FnMut ( & mut Decoder , uint ) -> DecodeResult < T > ,
2088
2083
{
2089
- debug ! ( "read_enum_variant(names={})" , names) ;
2090
2084
let name = match self . pop ( ) {
2091
2085
Json :: String ( s) => s,
2092
2086
Json :: Object ( mut o) => {
@@ -2129,14 +2123,12 @@ impl ::Decoder<DecoderError> for Decoder {
2129
2123
fn read_enum_variant_arg < T , F > ( & mut self , idx : uint , f : F ) -> DecodeResult < T > where
2130
2124
F : FnOnce ( & mut Decoder ) -> DecodeResult < T > ,
2131
2125
{
2132
- debug ! ( "read_enum_variant_arg(idx={})" , idx) ;
2133
2126
f ( self )
2134
2127
}
2135
2128
2136
2129
fn read_enum_struct_variant < T , F > ( & mut self , names : & [ & str ] , f : F ) -> DecodeResult < T > where
2137
2130
F : FnMut ( & mut Decoder , uint ) -> DecodeResult < T > ,
2138
2131
{
2139
- debug ! ( "read_enum_struct_variant(names={})" , names) ;
2140
2132
self . read_enum_variant ( names, f)
2141
2133
}
2142
2134
@@ -2148,14 +2140,12 @@ impl ::Decoder<DecoderError> for Decoder {
2148
2140
-> DecodeResult < T > where
2149
2141
F : FnOnce ( & mut Decoder ) -> DecodeResult < T > ,
2150
2142
{
2151
- debug ! ( "read_enum_struct_variant_field(name={}, idx={})" , name, idx) ;
2152
2143
self . read_enum_variant_arg ( idx, f)
2153
2144
}
2154
2145
2155
2146
fn read_struct < T , F > ( & mut self , name : & str , len : uint , f : F ) -> DecodeResult < T > where
2156
2147
F : FnOnce ( & mut Decoder ) -> DecodeResult < T > ,
2157
2148
{
2158
- debug ! ( "read_struct(name={}, len={})" , name, len) ;
2159
2149
let value = try!( f ( self ) ) ;
2160
2150
self . pop ( ) ;
2161
2151
Ok ( value)
@@ -2168,7 +2158,6 @@ impl ::Decoder<DecoderError> for Decoder {
2168
2158
-> DecodeResult < T > where
2169
2159
F : FnOnce ( & mut Decoder ) -> DecodeResult < T > ,
2170
2160
{
2171
- debug ! ( "read_struct_field(name={}, idx={})" , name, idx) ;
2172
2161
let mut obj = try!( expect ! ( self . pop( ) , Object ) ) ;
2173
2162
2174
2163
let value = match obj. remove ( & name. to_string ( ) ) {
@@ -2193,7 +2182,6 @@ impl ::Decoder<DecoderError> for Decoder {
2193
2182
fn read_tuple < T , F > ( & mut self , tuple_len : uint , f : F ) -> DecodeResult < T > where
2194
2183
F : FnOnce ( & mut Decoder ) -> DecodeResult < T > ,
2195
2184
{
2196
- debug ! ( "read_tuple()" ) ;
2197
2185
self . read_seq ( move |d, len| {
2198
2186
if len == tuple_len {
2199
2187
f ( d)
@@ -2206,7 +2194,6 @@ impl ::Decoder<DecoderError> for Decoder {
2206
2194
fn read_tuple_arg < T , F > ( & mut self , idx : uint , f : F ) -> DecodeResult < T > where
2207
2195
F : FnOnce ( & mut Decoder ) -> DecodeResult < T > ,
2208
2196
{
2209
- debug ! ( "read_tuple_arg(idx={})" , idx) ;
2210
2197
self . read_seq_elt ( idx, f)
2211
2198
}
2212
2199
@@ -2217,7 +2204,6 @@ impl ::Decoder<DecoderError> for Decoder {
2217
2204
-> DecodeResult < T > where
2218
2205
F : FnOnce ( & mut Decoder ) -> DecodeResult < T > ,
2219
2206
{
2220
- debug ! ( "read_tuple_struct(name={})" , name) ;
2221
2207
self . read_tuple ( len, f)
2222
2208
}
2223
2209
@@ -2227,14 +2213,12 @@ impl ::Decoder<DecoderError> for Decoder {
2227
2213
-> DecodeResult < T > where
2228
2214
F : FnOnce ( & mut Decoder ) -> DecodeResult < T > ,
2229
2215
{
2230
- debug ! ( "read_tuple_struct_arg(idx={})" , idx) ;
2231
2216
self . read_tuple_arg ( idx, f)
2232
2217
}
2233
2218
2234
2219
fn read_option < T , F > ( & mut self , mut f : F ) -> DecodeResult < T > where
2235
2220
F : FnMut ( & mut Decoder , bool ) -> DecodeResult < T > ,
2236
2221
{
2237
- debug ! ( "read_option()" ) ;
2238
2222
match self . pop ( ) {
2239
2223
Json :: Null => f ( self , false ) ,
2240
2224
value => { self . stack . push ( value) ; f ( self , true ) }
@@ -2244,7 +2228,6 @@ impl ::Decoder<DecoderError> for Decoder {
2244
2228
fn read_seq < T , F > ( & mut self , f : F ) -> DecodeResult < T > where
2245
2229
F : FnOnce ( & mut Decoder , uint ) -> DecodeResult < T > ,
2246
2230
{
2247
- debug ! ( "read_seq()" ) ;
2248
2231
let array = try!( expect ! ( self . pop( ) , Array ) ) ;
2249
2232
let len = array. len ( ) ;
2250
2233
for v in array. into_iter ( ) . rev ( ) {
@@ -2256,14 +2239,12 @@ impl ::Decoder<DecoderError> for Decoder {
2256
2239
fn read_seq_elt < T , F > ( & mut self , idx : uint , f : F ) -> DecodeResult < T > where
2257
2240
F : FnOnce ( & mut Decoder ) -> DecodeResult < T > ,
2258
2241
{
2259
- debug ! ( "read_seq_elt(idx={})" , idx) ;
2260
2242
f ( self )
2261
2243
}
2262
2244
2263
2245
fn read_map < T , F > ( & mut self , f : F ) -> DecodeResult < T > where
2264
2246
F : FnOnce ( & mut Decoder , uint ) -> DecodeResult < T > ,
2265
2247
{
2266
- debug ! ( "read_map()" ) ;
2267
2248
let obj = try!( expect ! ( self . pop( ) , Object ) ) ;
2268
2249
let len = obj. len ( ) ;
2269
2250
for ( key, value) in obj. into_iter ( ) {
@@ -2276,14 +2257,12 @@ impl ::Decoder<DecoderError> for Decoder {
2276
2257
fn read_map_elt_key < T , F > ( & mut self , idx : uint , f : F ) -> DecodeResult < T > where
2277
2258
F : FnOnce ( & mut Decoder ) -> DecodeResult < T > ,
2278
2259
{
2279
- debug ! ( "read_map_elt_key(idx={})" , idx) ;
2280
2260
f ( self )
2281
2261
}
2282
2262
2283
2263
fn read_map_elt_val < T , F > ( & mut self , idx : uint , f : F ) -> DecodeResult < T > where
2284
2264
F : FnOnce ( & mut Decoder ) -> DecodeResult < T > ,
2285
2265
{
2286
- debug ! ( "read_map_elt_val(idx={})" , idx) ;
2287
2266
f ( self )
2288
2267
}
2289
2268
@@ -2445,9 +2424,7 @@ mod tests {
2445
2424
use super :: ParserError :: * ;
2446
2425
use super :: DecoderError :: * ;
2447
2426
use super :: JsonEvent :: * ;
2448
- use super :: ParserState :: * ;
2449
2427
use super :: StackElement :: * ;
2450
- use super :: InternalStackElement :: * ;
2451
2428
use super :: { PrettyEncoder , Json , from_str, DecodeResult , DecoderError , JsonEvent , Parser ,
2452
2429
StackElement , Stack , Encoder , Decoder } ;
2453
2430
use std:: { i64, u64, f32, f64, io} ;
@@ -2682,8 +2659,6 @@ mod tests {
2682
2659
}
2683
2660
2684
2661
fn with_str_writer < F > ( f : F ) -> string:: String where F : FnOnce ( & mut io:: Writer ) {
2685
- use std:: str;
2686
-
2687
2662
let mut m = Vec :: new ( ) ;
2688
2663
f ( & mut m as & mut io:: Writer ) ;
2689
2664
string:: String :: from_utf8 ( m) . unwrap ( )
@@ -2760,9 +2735,9 @@ mod tests {
2760
2735
fn test_write_char ( ) {
2761
2736
check_encoder_for_simple ! ( 'a' , "\" a\" " ) ;
2762
2737
check_encoder_for_simple ! ( '\t' , "\" \\ t\" " ) ;
2763
- check_encoder_for_simple ! ( '\u00a0 ' , "\" \u00a0 \" " ) ;
2764
- check_encoder_for_simple ! ( '\uabcd ' , "\" \uabcd \" " ) ;
2765
- check_encoder_for_simple ! ( ' \U 0010 ffff ' , "\" \U 0010ffff \" " ) ;
2738
+ check_encoder_for_simple ! ( '\u{00a0} ' , "\" \u{00a0} \" " ) ;
2739
+ check_encoder_for_simple ! ( '\u{abcd} ' , "\" \u{abcd} \" " ) ;
2740
+ check_encoder_for_simple ! ( '\u{10ffff} ' , "\" \u{10ffff} \" " ) ;
2766
2741
}
2767
2742
2768
2743
#[ test]
0 commit comments