From dd109bc9e9b8a6a5585e8bf1093ec84dcad61309 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 29 Jul 2016 10:23:06 -0700 Subject: Touch up the encoder/decoder a bit * Whitespace things * Don't make `State` public * Remove `#[cfg]` annotations --- src/decoder/mod.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src/decoder') diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index 9720528..51a9ea2 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -1,9 +1,7 @@ use std::error; use std::fmt; -#[cfg(feature = "rustc-serialize")] use std::collections::{btree_map, BTreeMap}; -#[cfg(feature = "rustc-serialize")] use std::iter::Peekable; use Value; @@ -22,9 +20,11 @@ pub struct Decoder { /// whether fields were decoded or not. pub toml: Option, cur_field: Option, - #[cfg(feature = "rustc-serialize")] + + // These aren't used if serde is in use + #[cfg_attr(feature = "serde", allow(dead_code))] cur_map: Peekable>, - #[cfg(feature = "rustc-serialize")] + #[cfg_attr(feature = "serde", allow(dead_code))] leftover_map: ::Table, } @@ -135,7 +135,6 @@ impl Decoder { Decoder::new_empty(toml, cur_field) } - #[cfg(feature = "rustc-serialize")] fn new_empty(toml: Option, cur_field: Option) -> Decoder { Decoder { toml: toml, @@ -145,14 +144,6 @@ impl Decoder { } } - #[cfg(not(feature = "rustc-serialize"))] - fn new_empty(toml: Option, cur_field: Option) -> Decoder { - Decoder { - toml: toml, - cur_field: cur_field, - } - } - fn err(&self, kind: DecodeErrorKind) -> DecodeError { DecodeError { field: self.cur_field.clone(), -- cgit v1.2.3