Skip to content

Commit

Permalink
Change create_permission to take a reference
Browse files Browse the repository at this point in the history
{ChannelId,GuildChannel}::create_permission don't need to take
ownership over the overwrite, so just accept a reference.
  • Loading branch information
Zeyla Hellyer committed May 27, 2017
1 parent 7dbae6b commit aea9885
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/model/channel/channel_id.rs
Expand Up @@ -49,7 +49,7 @@ impl ChannelId {
/// [`PermissionOverwrite`]: struct.PermissionOverwrite.html
/// [`Role`]: struct.Role.html
/// [Manage Channels]: permissions/constant.MANAGE_CHANNELS.html
pub fn create_permission(&self, target: PermissionOverwrite)
pub fn create_permission(&self, target: &PermissionOverwrite)
-> Result<()> {
let (id, kind) = match target.kind {
PermissionOverwriteType::Member(id) => (id.0, "member"),
Expand Down Expand Up @@ -431,13 +431,13 @@ impl ChannelId {
Message::check_embed_length(&map)?;

let message = http::send_message(self.0, &Value::Object(map))?;

if let Some(reactions) = reactions {
for reaction in reactions {
self.create_reaction(message.id, reaction)?;
}
}

Ok(message)
}

Expand Down
2 changes: 1 addition & 1 deletion src/model/channel/guild_channel.rs
Expand Up @@ -180,7 +180,7 @@ impl GuildChannel {
/// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html
/// [Send TTS Messages]: permissions/constant.SEND_TTS_MESSAGES.html
#[inline]
pub fn create_permission(&self, target: PermissionOverwrite) -> Result<()> {
pub fn create_permission(&self, target: &PermissionOverwrite) -> Result<()> {
self.id.create_permission(target)
}

Expand Down

0 comments on commit aea9885

Please sign in to comment.