diff options
| author | Austin Hellyer <[email protected]> | 2016-11-29 20:51:10 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-29 22:27:59 -0800 |
| commit | 93b990d8d1bc9df69b8e27a3db61da570822aad6 (patch) | |
| tree | 6305cf635df90681527a8e736f65ff19f21fd8bc /src/model/utils.rs | |
| parent | Add more shiny readme badges (diff) | |
| download | serenity-93b990d8d1bc9df69b8e27a3db61da570822aad6.tar.xz serenity-93b990d8d1bc9df69b8e27a3db61da570822aad6.zip | |
Clean up the codebase
Diffstat (limited to 'src/model/utils.rs')
| -rw-r--r-- | src/model/utils.rs | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/src/model/utils.rs b/src/model/utils.rs index 0611a9f..9b4f6e4 100644 --- a/src/model/utils.rs +++ b/src/model/utils.rs @@ -25,19 +25,6 @@ use ::client::CACHE; use ::ext::cache::ChannelRef; #[macro_escape] -macro_rules! missing { - (@ $name:expr, $json:ident, $value:expr) => { - (Ok($value), warn_field($name, $json)).0 - }; - ($json:ident, $ty:ident $(::$ext:ident)* ( $($value:expr),*$(,)* ) ) => { - (Ok($ty$(::$ext)* ( $($value),* )), warn_field(stringify!($ty$(::$ext)*), $json)).0 - }; - ($json:ident, $ty:ident $(::$ext:ident)* { $($name:ident: $value:expr),*$(,)* } ) => { - (Ok($ty$(::$ext)* { $($name: $value),* }), warn_field(stringify!($ty$(::$ext)*), $json)).0 - }; -} - -#[macro_escape] macro_rules! req { ($opt:expr) => { try!($opt.ok_or(Error::Decode(concat!("Type mismatch in model:", @@ -253,7 +240,7 @@ pub fn opt<T, F: FnOnce(Value) -> Result<T>>(map: &mut BTreeMap<String, Value>, } } -pub fn parse_discriminator(value: Value) -> Result<u16> { +pub fn decode_discriminator(value: Value) -> Result<u16> { match value { Value::I64(v) => Ok(v as u16), Value::U64(v) => Ok(v as u16), @@ -303,9 +290,3 @@ pub fn user_has_perms(channel_id: ChannelId, Ok(permissions.is_empty()) } - -pub fn warn_field(name: &str, map: BTreeMap<String, Value>) { - if !map.is_empty() { - debug!("Unhandled keys: {} has {:?}", name, Value::Object(map)) - } -} |