diff options
| author | acdenisSK <[email protected]> | 2017-10-03 16:55:58 +0200 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-10-09 15:47:48 -0700 |
| commit | 06dc6937bd3d4e5912de08e4ac3630a1f83b7f5a (patch) | |
| tree | eee16dc9d1c35e2b17a0a59d55cc85fa82726587 /src/builder/edit_guild.rs | |
| parent | Use the de-generification trick. (diff) | |
| download | serenity-06dc6937bd3d4e5912de08e4ac3630a1f83b7f5a.tar.xz serenity-06dc6937bd3d4e5912de08e4ac3630a1f83b7f5a.zip | |
Revert "Use the de-generification trick."
Makes the compiliation time just a bit worse
Diffstat (limited to 'src/builder/edit_guild.rs')
| -rw-r--r-- | src/builder/edit_guild.rs | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/builder/edit_guild.rs b/src/builder/edit_guild.rs index a4f2c54..0719305 100644 --- a/src/builder/edit_guild.rs +++ b/src/builder/edit_guild.rs @@ -22,14 +22,13 @@ impl EditGuild { /// valid. /// /// [`afk_timeout`]: #method.afk_timeout - pub fn afk_channel<C: Into<ChannelId>>(self, channel: Option<C>) -> Self { - self._afk_channel(channel.map(|c| c.into())) - } - - fn _afk_channel(mut self, channel: Option<ChannelId>) -> Self { + pub fn afk_channel<C: Into<ChannelId>>(mut self, channel: Option<C>) -> Self { self.0.insert( "afk_channel_id".to_string(), - channel.map_or(Value::Null, |ChannelId(id)| Value::Number(Number::from(id))) + match channel { + Some(channel) => Value::Number(Number::from(channel.into().0)), + None => Value::Null, + }, ); self @@ -99,14 +98,10 @@ impl EditGuild { /// Transfers the ownership of the guild to another user by Id. /// /// **Note**: The current user must be the owner of the guild. - pub fn owner<U: Into<UserId>>(self, user_id: U) -> Self { - self._owner(user_id.into()) - } - - fn _owner(mut self, user_id: UserId) -> Self { + pub fn owner<U: Into<UserId>>(mut self, user_id: U) -> Self { self.0.insert( "owner_id".to_string(), - Value::Number(Number::from(user_id.0)), + Value::Number(Number::from(user_id.into().0)), ); self @@ -190,13 +185,9 @@ impl EditGuild { /// /// [`VerificationLevel`]: ../model/enum.VerificationLevel.html /// [`VerificationLevel::High`]: ../model/enum.VerificationLevel.html#variant.High - pub fn verification_level<V>(self, verification_level: V) -> Self + pub fn verification_level<V>(mut self, verification_level: V) -> Self where V: Into<VerificationLevel> { - self._verification_level(verification_level.into()) - } - - fn _verification_level(mut self, verification_level: VerificationLevel) -> Self { - let num = Value::Number(Number::from(verification_level.num())); + let num = Value::Number(Number::from(verification_level.into().num())); self.0.insert("verification_level".to_string(), num); |