aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel.rs
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-29 20:51:10 -0800
committerAustin Hellyer <[email protected]>2016-11-29 22:27:59 -0800
commit93b990d8d1bc9df69b8e27a3db61da570822aad6 (patch)
tree6305cf635df90681527a8e736f65ff19f21fd8bc /src/model/channel.rs
parentAdd more shiny readme badges (diff)
downloadserenity-93b990d8d1bc9df69b8e27a3db61da570822aad6.tar.xz
serenity-93b990d8d1bc9df69b8e27a3db61da570822aad6.zip
Clean up the codebase
Diffstat (limited to 'src/model/channel.rs')
-rw-r--r--src/model/channel.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/model/channel.rs b/src/model/channel.rs
index 33e6044..13cf506 100644
--- a/src/model/channel.rs
+++ b/src/model/channel.rs
@@ -6,7 +6,6 @@ use super::utils::{
into_string,
opt,
remove,
- warn_field,
};
use super::*;
use ::constants;
@@ -343,7 +342,7 @@ impl Group {
/// Returns the formatted URI of the group's icon if one exists.
pub fn icon_url(&self) -> Option<String> {
self.icon.as_ref().map(|icon|
- format!(cdn_concat!("/channel-icons/{}/{}.jpg"), self.channel_id, icon))
+ format!(cdn!("/channel-icons/{}/{}.jpg"), self.channel_id, icon))
}
/// Leaves the group.
@@ -639,8 +638,7 @@ impl Message {
}}
let mut gen = format!("{}", self.author.mention());
- gen.push(':');
- gen.push(' ');
+ gen.push_str(": ");
gen.push_str(content);
let map = ObjectBuilder::new()
@@ -690,7 +688,7 @@ impl PermissionOverwrite {
_ => return Err(Error::Decode("Expected valid PermissionOverwrite type", Value::String(kind))),
};
- missing!(map, PermissionOverwrite {
+ Ok(PermissionOverwrite {
kind: kind,
allow: try!(remove(&mut map, "allow").and_then(Permissions::decode)),
deny: try!(remove(&mut map, "deny").and_then(Permissions::decode)),
@@ -711,7 +709,7 @@ impl PrivateChannel {
let mut recipients = try!(decode_array(try!(remove(&mut map, "recipients")),
User::decode));
- missing!(map, PrivateChannel {
+ Ok(PrivateChannel {
id: try!(remove(&mut map, "id").and_then(ChannelId::decode)),
kind: try!(remove(&mut map, "type").and_then(ChannelType::decode)),
last_message_id: try!(opt(&mut map, "last_message_id", MessageId::decode)),
@@ -858,7 +856,8 @@ impl GuildChannel {
#[doc(hidden)]
pub fn decode_guild(value: Value, guild_id: GuildId) -> Result<GuildChannel> {
let mut map = try!(into_map(value));
- missing!(map, GuildChannel {
+
+ Ok(GuildChannel {
id: try!(remove(&mut map, "id").and_then(ChannelId::decode)),
name: try!(remove(&mut map, "name").and_then(into_string)),
guild_id: guild_id,