Skip to content

Commit 0abfe34

Browse files
committed
Merge pull request #19980 from erickt/cleanup-serialize
Cleanup serialize Reviewed-by: alexcrichton
2 parents f27ecd5 + d729c96 commit 0abfe34

File tree

1 file changed

+9
-34
lines changed

1 file changed

+9
-34
lines changed

src/libserialize/json.rs

+9-34
Original file line numberDiff line numberDiff line change
@@ -2016,7 +2016,6 @@ macro_rules! read_primitive {
20162016

20172017
impl ::Decoder<DecoderError> for Decoder {
20182018
fn read_nil(&mut self) -> DecodeResult<()> {
2019-
debug!("read_nil");
20202019
expect!(self.pop(), Null)
20212020
}
20222021

@@ -2034,7 +2033,6 @@ impl ::Decoder<DecoderError> for Decoder {
20342033
fn read_f32(&mut self) -> DecodeResult<f32> { self.read_f64().map(|x| x as f32) }
20352034

20362035
fn read_f64(&mut self) -> DecodeResult<f64> {
2037-
debug!("read_f64");
20382036
match self.pop() {
20392037
Json::I64(f) => Ok(f as f64),
20402038
Json::U64(f) => Ok(f as f64),
@@ -2053,7 +2051,6 @@ impl ::Decoder<DecoderError> for Decoder {
20532051
}
20542052

20552053
fn read_bool(&mut self) -> DecodeResult<bool> {
2056-
debug!("read_bool");
20572054
expect!(self.pop(), Boolean)
20582055
}
20592056

@@ -2071,22 +2068,19 @@ impl ::Decoder<DecoderError> for Decoder {
20712068
}
20722069

20732070
fn read_str(&mut self) -> DecodeResult<string::String> {
2074-
debug!("read_str");
20752071
expect!(self.pop(), String)
20762072
}
20772073

2078-
fn read_enum<T, F>(&mut self, name: &str, f: F) -> DecodeResult<T> where
2074+
fn read_enum<T, F>(&mut self, _name: &str, f: F) -> DecodeResult<T> where
20792075
F: FnOnce(&mut Decoder) -> DecodeResult<T>,
20802076
{
2081-
debug!("read_enum({})", name);
20822077
f(self)
20832078
}
20842079

20852080
fn read_enum_variant<T, F>(&mut self, names: &[&str],
20862081
mut f: F) -> DecodeResult<T>
20872082
where F: FnMut(&mut Decoder, uint) -> DecodeResult<T>,
20882083
{
2089-
debug!("read_enum_variant(names={})", names);
20902084
let name = match self.pop() {
20912085
Json::String(s) => s,
20922086
Json::Object(mut o) => {
@@ -2126,49 +2120,44 @@ impl ::Decoder<DecoderError> for Decoder {
21262120
f(self, idx)
21272121
}
21282122

2129-
fn read_enum_variant_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
2123+
fn read_enum_variant_arg<T, F>(&mut self, _idx: uint, f: F) -> DecodeResult<T> where
21302124
F: FnOnce(&mut Decoder) -> DecodeResult<T>,
21312125
{
2132-
debug!("read_enum_variant_arg(idx={})", idx);
21332126
f(self)
21342127
}
21352128

21362129
fn read_enum_struct_variant<T, F>(&mut self, names: &[&str], f: F) -> DecodeResult<T> where
21372130
F: FnMut(&mut Decoder, uint) -> DecodeResult<T>,
21382131
{
2139-
debug!("read_enum_struct_variant(names={})", names);
21402132
self.read_enum_variant(names, f)
21412133
}
21422134

21432135

21442136
fn read_enum_struct_variant_field<T, F>(&mut self,
2145-
name: &str,
2137+
_name: &str,
21462138
idx: uint,
21472139
f: F)
21482140
-> DecodeResult<T> where
21492141
F: FnOnce(&mut Decoder) -> DecodeResult<T>,
21502142
{
2151-
debug!("read_enum_struct_variant_field(name={}, idx={})", name, idx);
21522143
self.read_enum_variant_arg(idx, f)
21532144
}
21542145

2155-
fn read_struct<T, F>(&mut self, name: &str, len: uint, f: F) -> DecodeResult<T> where
2146+
fn read_struct<T, F>(&mut self, _name: &str, _len: uint, f: F) -> DecodeResult<T> where
21562147
F: FnOnce(&mut Decoder) -> DecodeResult<T>,
21572148
{
2158-
debug!("read_struct(name={}, len={})", name, len);
21592149
let value = try!(f(self));
21602150
self.pop();
21612151
Ok(value)
21622152
}
21632153

21642154
fn read_struct_field<T, F>(&mut self,
21652155
name: &str,
2166-
idx: uint,
2156+
_idx: uint,
21672157
f: F)
21682158
-> DecodeResult<T> where
21692159
F: FnOnce(&mut Decoder) -> DecodeResult<T>,
21702160
{
2171-
debug!("read_struct_field(name={}, idx={})", name, idx);
21722161
let mut obj = try!(expect!(self.pop(), Object));
21732162

21742163
let value = match obj.remove(&name.to_string()) {
@@ -2193,7 +2182,6 @@ impl ::Decoder<DecoderError> for Decoder {
21932182
fn read_tuple<T, F>(&mut self, tuple_len: uint, f: F) -> DecodeResult<T> where
21942183
F: FnOnce(&mut Decoder) -> DecodeResult<T>,
21952184
{
2196-
debug!("read_tuple()");
21972185
self.read_seq(move |d, len| {
21982186
if len == tuple_len {
21992187
f(d)
@@ -2206,18 +2194,16 @@ impl ::Decoder<DecoderError> for Decoder {
22062194
fn read_tuple_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
22072195
F: FnOnce(&mut Decoder) -> DecodeResult<T>,
22082196
{
2209-
debug!("read_tuple_arg(idx={})", idx);
22102197
self.read_seq_elt(idx, f)
22112198
}
22122199

22132200
fn read_tuple_struct<T, F>(&mut self,
2214-
name: &str,
2201+
_name: &str,
22152202
len: uint,
22162203
f: F)
22172204
-> DecodeResult<T> where
22182205
F: FnOnce(&mut Decoder) -> DecodeResult<T>,
22192206
{
2220-
debug!("read_tuple_struct(name={})", name);
22212207
self.read_tuple(len, f)
22222208
}
22232209

@@ -2227,14 +2213,12 @@ impl ::Decoder<DecoderError> for Decoder {
22272213
-> DecodeResult<T> where
22282214
F: FnOnce(&mut Decoder) -> DecodeResult<T>,
22292215
{
2230-
debug!("read_tuple_struct_arg(idx={})", idx);
22312216
self.read_tuple_arg(idx, f)
22322217
}
22332218

22342219
fn read_option<T, F>(&mut self, mut f: F) -> DecodeResult<T> where
22352220
F: FnMut(&mut Decoder, bool) -> DecodeResult<T>,
22362221
{
2237-
debug!("read_option()");
22382222
match self.pop() {
22392223
Json::Null => f(self, false),
22402224
value => { self.stack.push(value); f(self, true) }
@@ -2244,7 +2228,6 @@ impl ::Decoder<DecoderError> for Decoder {
22442228
fn read_seq<T, F>(&mut self, f: F) -> DecodeResult<T> where
22452229
F: FnOnce(&mut Decoder, uint) -> DecodeResult<T>,
22462230
{
2247-
debug!("read_seq()");
22482231
let array = try!(expect!(self.pop(), Array));
22492232
let len = array.len();
22502233
for v in array.into_iter().rev() {
@@ -2253,17 +2236,15 @@ impl ::Decoder<DecoderError> for Decoder {
22532236
f(self, len)
22542237
}
22552238

2256-
fn read_seq_elt<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
2239+
fn read_seq_elt<T, F>(&mut self, _idx: uint, f: F) -> DecodeResult<T> where
22572240
F: FnOnce(&mut Decoder) -> DecodeResult<T>,
22582241
{
2259-
debug!("read_seq_elt(idx={})", idx);
22602242
f(self)
22612243
}
22622244

22632245
fn read_map<T, F>(&mut self, f: F) -> DecodeResult<T> where
22642246
F: FnOnce(&mut Decoder, uint) -> DecodeResult<T>,
22652247
{
2266-
debug!("read_map()");
22672248
let obj = try!(expect!(self.pop(), Object));
22682249
let len = obj.len();
22692250
for (key, value) in obj.into_iter() {
@@ -2273,17 +2254,15 @@ impl ::Decoder<DecoderError> for Decoder {
22732254
f(self, len)
22742255
}
22752256

2276-
fn read_map_elt_key<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
2257+
fn read_map_elt_key<T, F>(&mut self, _idx: uint, f: F) -> DecodeResult<T> where
22772258
F: FnOnce(&mut Decoder) -> DecodeResult<T>,
22782259
{
2279-
debug!("read_map_elt_key(idx={})", idx);
22802260
f(self)
22812261
}
22822262

2283-
fn read_map_elt_val<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
2263+
fn read_map_elt_val<T, F>(&mut self, _idx: uint, f: F) -> DecodeResult<T> where
22842264
F: FnOnce(&mut Decoder) -> DecodeResult<T>,
22852265
{
2286-
debug!("read_map_elt_val(idx={})", idx);
22872266
f(self)
22882267
}
22892268

@@ -2445,9 +2424,7 @@ mod tests {
24452424
use super::ParserError::*;
24462425
use super::DecoderError::*;
24472426
use super::JsonEvent::*;
2448-
use super::ParserState::*;
24492427
use super::StackElement::*;
2450-
use super::InternalStackElement::*;
24512428
use super::{PrettyEncoder, Json, from_str, DecodeResult, DecoderError, JsonEvent, Parser,
24522429
StackElement, Stack, Encoder, Decoder};
24532430
use std::{i64, u64, f32, f64, io};
@@ -2682,8 +2659,6 @@ mod tests {
26822659
}
26832660

26842661
fn with_str_writer<F>(f: F) -> string::String where F: FnOnce(&mut io::Writer){
2685-
use std::str;
2686-
26872662
let mut m = Vec::new();
26882663
f(&mut m as &mut io::Writer);
26892664
string::String::from_utf8(m).unwrap()

0 commit comments

Comments
 (0)