diff options
Diffstat (limited to 'src/libserialize/json.rs')
| -rw-r--r-- | src/libserialize/json.rs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index c811a16e2b1..e7b2d0c8eba 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -1970,7 +1970,7 @@ impl Decoder { } } -macro_rules! expect( +macro_rules! expect { ($e:expr, Null) => ({ match $e { Json::Null => Ok(()), @@ -1987,7 +1987,7 @@ macro_rules! expect( } } }) -) +} macro_rules! read_primitive { ($name:ident, $ty:ty) => { @@ -2020,16 +2020,16 @@ impl ::Decoder<DecoderError> for Decoder { expect!(self.pop(), Null) } - read_primitive!(read_uint, uint) - read_primitive!(read_u8, u8) - read_primitive!(read_u16, u16) - read_primitive!(read_u32, u32) - read_primitive!(read_u64, u64) - read_primitive!(read_int, int) - read_primitive!(read_i8, i8) - read_primitive!(read_i16, i16) - read_primitive!(read_i32, i32) - read_primitive!(read_i64, i64) + read_primitive! { read_uint, uint } + read_primitive! { read_u8, u8 } + read_primitive! { read_u16, u16 } + read_primitive! { read_u32, u32 } + read_primitive! { read_u64, u64 } + read_primitive! { read_int, int } + read_primitive! { read_i8, i8 } + read_primitive! { read_i16, i16 } + read_primitive! { read_i32, i32 } + read_primitive! { read_i64, i64 } fn read_f32(&mut self) -> DecodeResult<f32> { self.read_f64().map(|x| x as f32) } @@ -2298,25 +2298,25 @@ pub trait ToJson for Sized? { fn to_json(&self) -> Json; } -macro_rules! to_json_impl_i64( +macro_rules! to_json_impl_i64 { ($($t:ty), +) => ( $(impl ToJson for $t { fn to_json(&self) -> Json { Json::I64(*self as i64) } })+ ) -) +} -to_json_impl_i64!(int, i8, i16, i32, i64) +to_json_impl_i64! { int, i8, i16, i32, i64 } -macro_rules! to_json_impl_u64( +macro_rules! to_json_impl_u64 { ($($t:ty), +) => ( $(impl ToJson for $t { fn to_json(&self) -> Json { Json::U64(*self as u64) } })+ ) -) +} -to_json_impl_u64!(uint, u8, u16, u32, u64) +to_json_impl_u64! { uint, u8, u16, u32, u64 } impl ToJson for Json { fn to_json(&self) -> Json { self.clone() } @@ -2730,7 +2730,7 @@ mod tests { ); } - macro_rules! check_encoder_for_simple( + macro_rules! check_encoder_for_simple { ($value:expr, $expected:expr) => ({ let s = with_str_writer(|writer| { let mut encoder = Encoder::new(writer); @@ -2744,7 +2744,7 @@ mod tests { }); assert_eq!(s, $expected); }) - ) + } #[test] fn test_write_some() { @@ -2948,7 +2948,7 @@ mod tests { #[test] fn test_decode_tuple() { let t: (uint, uint, uint) = super::decode("[1, 2, 3]").unwrap(); - assert_eq!(t, (1u, 2, 3)) + assert_eq!(t, (1u, 2, 3)); let t: (uint, string::String) = super::decode("[1, \"two\"]").unwrap(); assert_eq!(t, (1u, "two".into_string())); |
