From 5076f808c5155677f6e029f56e6c1293683eb508 Mon Sep 17 00:00:00 2001 From: Michael Krasnitski Date: Mon, 20 Jun 2022 12:11:57 -0400 Subject: [PATCH] When possible, wrap an Id method instead of constructing a builder directly --- src/model/channel/guild_channel.rs | 2 +- src/model/guild/mod.rs | 6 +++--- src/model/guild/partial_guild.rs | 4 ++-- src/model/invite.rs | 6 +----- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/model/channel/guild_channel.rs b/src/model/channel/guild_channel.rs index eb64b1be782..a361ca4f083 100644 --- a/src/model/channel/guild_channel.rs +++ b/src/model/channel/guild_channel.rs @@ -1157,7 +1157,7 @@ impl GuildChannel { /// Returns a request builder that creates a [`StageInstance`] when executed. pub fn create_stage_instance(&self) -> CreateStageInstance { - CreateStageInstance::new(self.id) + self.id.create_stage_instance() } /// Edits a stage instance. diff --git a/src/model/guild/mod.rs b/src/model/guild/mod.rs index 15b05819472..36cf46d7f8b 100644 --- a/src/model/guild/mod.rs +++ b/src/model/guild/mod.rs @@ -577,7 +577,7 @@ impl Guild { /// /// [Manage Channels]: Permissions::MANAGE_CHANNELS pub fn create_channel(&self) -> CreateChannel { - CreateChannel::new(self.id) + self.id.create_channel() } /// Creates an emoji in the guild with a name and base64-encoded image. The @@ -860,7 +860,7 @@ impl Guild { /// /// [Manage Events]: Permissions::MANAGE_EVENTS pub fn create_scheduled_event(&self) -> CreateScheduledEvent { - CreateScheduledEvent::new(self.id) + self.id.create_scheduled_event() } /// Returns a request builder that will create a new [`Sticker`] in the guild when executed. @@ -869,7 +869,7 @@ impl Guild { /// /// [Manage Emojis and Stickers]: crate::model::permissions::Permissions::MANAGE_EMOJIS_AND_STICKERS pub fn create_sticker<'a>(&self) -> CreateSticker<'a> { - CreateSticker::new(self.id) + self.id.create_sticker() } /// Deletes the current guild if the current user is the owner of the diff --git a/src/model/guild/partial_guild.rs b/src/model/guild/partial_guild.rs index ff8a0d5fecf..507ef93a989 100644 --- a/src/model/guild/partial_guild.rs +++ b/src/model/guild/partial_guild.rs @@ -307,7 +307,7 @@ impl PartialGuild { /// [Manage Channels]: Permissions::MANAGE_CHANNELS #[inline] pub fn create_channel(&self) -> CreateChannel { - CreateChannel::new(self.id) + self.id.create_channel() } /// Creates an emoji in the guild with a name and base64-encoded image. @@ -569,7 +569,7 @@ impl PartialGuild { /// /// [Manage Emojis and Stickers]: crate::model::permissions::Permissions::MANAGE_EMOJIS_AND_STICKERS pub fn create_sticker<'a>(&self) -> CreateSticker<'a> { - CreateSticker::new(self.id) + self.id.create_sticker() } /// Deletes the current guild if the current user is the owner of the diff --git a/src/model/invite.rs b/src/model/invite.rs index cc4db3accaf..1334d33c7ec 100644 --- a/src/model/invite.rs +++ b/src/model/invite.rs @@ -74,11 +74,7 @@ impl Invite { /// [permission]: super::permissions #[inline] pub fn create(channel_id: impl Into) -> CreateInvite { - CreateInvite::new( - channel_id.into(), - #[cfg(feature = "cache")] - None, - ) + channel_id.into().create_invite() } /// Deletes the invite.