~tdeo/serde_bare

fdf8d3f7cf11483ef5c50c54d7589ae9c4054c2a — Tadeo Kondrak 1 year, 1 month ago d914cb6
Accept non-1 bools
2 files changed, 1 insertions(+), 4 deletions(-)

M src/de.rs
M src/error.rs
M src/de.rs => src/de.rs +1 -2
@@ 37,8 37,7 @@ where
    {
        match <u8 as de::Deserialize>::deserialize(self)? {
            0 => visitor.visit_bool(false),
            1 => visitor.visit_bool(true),
            _ => Err(Error::InvalidBool),
            _ => visitor.visit_bool(true),
        }
    }


M src/error.rs => src/error.rs +0 -2
@@ 17,7 17,6 @@ pub enum Error {
    IdentifierUnsupported,

    InvalidUtf8,
    InvalidBool,

    LengthOverflow,
    MapLengthRequired,


@@ 45,7 44,6 @@ impl Display for Error {
            Error::I128Unsupported => formatter.write_str("Bare does not support i128"),
            Error::IdentifierUnsupported => formatter.write_str("BARE does not support identifier"),
            Error::InvalidUtf8 => formatter.write_str("invalid utf-8 in string"),
            Error::InvalidBool => formatter.write_str("invalid bool, neither 0 or 1"),
            Error::LengthOverflow => formatter.write_str("length above u32::MAX"),
            Error::MapLengthRequired => formatter.write_str("map length required"),
        }