remove dead code

This commit is contained in:
Erick Tryzelaar 2014-08-02 15:46:07 -07:00
parent 62eda3e19f
commit 5298bf0301
3 changed files with 2 additions and 309 deletions

View File

@ -2,7 +2,7 @@ use test::Bencher;
use serialize::{Decoder, Decodable};
use de::{Deserializer, Deserializable, Token};
use de::{Deserializer, Deserializable};
//////////////////////////////////////////////////////////////////////////////
@ -13,31 +13,6 @@ enum Animal {
Frog(String, int)
}
/*
impl Deserializable for Animal {
#[inline]
fn deserialize_token<
D: Deserializer<E>, E
>(d: &mut D, token: Token) -> Result<Animal, E> {
match try!(d.expect_enum_start(token, "Animal", ["Dog", "Frog"])) {
0 => {
try!(d.expect_enum_end());
Ok(Dog)
}
1 => {
let x0 = try!(Deserializable::deserialize(d));
let x1 = try!(Deserializable::deserialize(d));
try!(d.expect_enum_end());
Ok(Frog(x0, x1))
}
_ => d.syntax_error(),
}
}
}
*/
//////////////////////////////////////////////////////////////////////////////
#[deriving(Show)]

View File

@ -3,8 +3,7 @@ use test::Bencher;
use serialize::{Decoder, Decodable};
use de;
use de::{Token, Deserializer, Deserializable};
use de::{Deserializer, Deserializable};
//////////////////////////////////////////////////////////////////////////////
@ -16,58 +15,6 @@ struct Inner {
c: HashMap<String, Option<char>>,
}
/*
impl Deserializable for Inner {
#[inline]
fn deserialize_token<
D: Deserializer<E>,
E
>(d: &mut D, token: Token) -> Result<Inner, E> {
match token {
de::StructStart("Inner", _) | de::MapStart(_) => { }
_ => { return d.syntax_error(); }
}
let mut a = None;
let mut b = None;
let mut c = None;
loop {
let token = match try!(d.expect_token()) {
de::End => { break; }
token => token,
};
let name = match token {
de::Str(name) => name,
de::String(ref name) => name.as_slice(),
_ => { return d.syntax_error(); }
};
match name {
"a" => {
a = Some(try!(de::Deserializable::deserialize(d)));
}
"b" => {
b = Some(try!(de::Deserializable::deserialize(d)));
}
"c" => {
c = Some(try!(de::Deserializable::deserialize(d)));
}
_ => { }
}
}
match (a, b, c) {
(Some(a), Some(b), Some(c)) => {
Ok(Inner { a: a, b: b, c: c })
}
_ => d.syntax_error(),
}
}
}
*/
//////////////////////////////////////////////////////////////////////////////
#[deriving(Clone, PartialEq, Show, Decodable)]
@ -76,50 +23,6 @@ struct Outer {
inner: Vec<Inner>,
}
/*
impl Deserializable for Outer {
#[inline]
fn deserialize_token<
D: Deserializer<E>,
E
>(d: &mut D, token: Token) -> Result<Outer, E> {
match token {
de::StructStart("Outer", _) | de::MapStart(_) => { }
_ => { return d.syntax_error(); }
}
let mut inner = None;
loop {
let token = match try!(d.expect_token()) {
de::End => { break; }
token => token,
};
let name = match token {
de::Str(name) => name,
de::String(ref name) => name.as_slice(),
_ => { return d.syntax_error(); }
};
match name {
"inner" => {
inner = Some(try!(de::Deserializable::deserialize(d)));
}
_ => { }
}
}
match inner {
Some(inner) => {
Ok(Outer { inner: inner })
}
_ => d.syntax_error(),
}
}
}
*/
//////////////////////////////////////////////////////////////////////////////
#[deriving(Show)]

View File

@ -2274,55 +2274,6 @@ mod tests {
Frog(String, Vec<int>)
}
/*
impl ser::Serializable for Animal {
#[inline]
fn serialize<
S: ser::Serializer<E>,
E
>(&self, s: &mut S) -> Result<(), E> {
match *self {
Dog => {
try!(s.serialize_enum_start("Animal", "Dog", 0));
s.serialize_enum_end()
}
Frog(ref x0, ref x1) => {
try!(s.serialize_enum_start("Animal", "Frog", 2));
try!(s.serialize_enum_sep(x0));
try!(s.serialize_enum_sep(x1));
s.serialize_enum_end()
}
}
}
}
impl de::Deserializable for Animal {
#[inline]
fn deserialize_token<
D: de::Deserializer<E>,
E
>(d: &mut D, token: de::Token) -> Result<Animal, E> {
match try!(d.expect_enum_start(token, "Animal", ["Dog", "Frog"])) {
0 => {
try!(d.expect_enum_end());
Ok(Dog)
}
1 => {
let x0 = try!(de::Deserializable::deserialize(d));
let x1 = try!(de::Deserializable::deserialize(d));
try!(d.expect_enum_end());
Ok(Frog(x0, x1))
}
_ => d.syntax_error(),
}
}
}
*/
impl ToJson for Animal {
fn to_json(&self) -> Json {
match *self {
@ -2353,83 +2304,6 @@ mod tests {
c: Vec<String>,
}
/*
impl ser::Serializable for Inner {
#[inline]
fn serialize<
S: ser::Serializer<E>,
E
>(&self, s: &mut S) -> Result<(), E> {
try!(s.serialize_struct_start("Inner", 3));
try!(s.serialize_struct_sep("a", &self.a));
try!(s.serialize_struct_sep("b", &self.b));
try!(s.serialize_struct_sep("c", &self.c));
s.serialize_struct_end()
}
}
impl de::Deserializable for Inner {
#[inline]
fn deserialize_token<
D: de::Deserializer<E>, E
>(d: &mut D, token: de::Token) -> Result<Inner, E> {
match token {
de::StructStart("Inner", _) |
de::MapStart(_) => {
let mut a = None;
let mut b = None;
let mut c = None;
loop {
match try!(d.expect_token()) {
de::End => { break; }
de::Str(name) => {
match name {
"a" => {
a = Some(try!(de::Deserializable::deserialize(d)));
}
"b" => {
b = Some(try!(de::Deserializable::deserialize(d)));
}
"c" => {
c = Some(try!(de::Deserializable::deserialize(d)));
}
_ => { }
}
}
de::String(ref name) => {
match name.as_slice() {
"a" => {
a = Some(try!(de::Deserializable::deserialize(d)));
}
"b" => {
b = Some(try!(de::Deserializable::deserialize(d)));
}
"c" => {
c = Some(try!(de::Deserializable::deserialize(d)));
}
_ => { }
}
}
_ => { return d.syntax_error(); }
}
}
match (a, b, c) {
(Some(a), Some(b), Some(c)) => {
Ok(Inner { a: a, b: b, c: c })
}
_ => d.syntax_error(),
}
}
_ => d.syntax_error(),
}
}
}
*/
impl ToJson for Inner {
fn to_json(&self) -> Json {
Object(
@ -2449,65 +2323,6 @@ mod tests {
inner: Vec<Inner>,
}
/*
impl ser::Serializable for Outer {
#[inline]
fn serialize<
S: ser::Serializer<E>,
E
>(&self, s: &mut S) -> Result<(), E> {
try!(s.serialize_struct_start("Outer", 1));
try!(s.serialize_struct_sep("inner", &self.inner));
s.serialize_struct_end()
}
}
impl de::Deserializable for Outer {
#[inline]
fn deserialize_token<
D: de::Deserializer<E>,
E
>(d: &mut D, token: de::Token) -> Result<Outer, E> {
match token {
de::StructStart("Outer", _) |
de::MapStart(_) => {
let mut inner = None;
loop {
let token = match try!(d.expect_token()) {
de::End => { break; }
token => token,
};
let key = match token {
de::Str(key) => key,
de::String(ref key) => key.as_slice(),
_ => { return d.syntax_error(); }
};
match key {
"inner" => {
inner = Some(try!(de::Deserializable::deserialize(d)));
}
_ => { }
}
}
match inner {
Some(inner) => {
Ok(Outer { inner: inner })
}
_ => d.syntax_error(),
}
}
_ => d.syntax_error(),
}
}
}
*/
impl ToJson for Outer {
fn to_json(&self) -> Json {
Object(