diff options
| author | acdenisSK <[email protected]> | 2017-10-01 21:59:33 +0200 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-10-09 15:46:37 -0700 |
| commit | 0ce8be869eeb2eb700e22f71b2e00872cc96a500 (patch) | |
| tree | 03dd981bc04ba8475333d057705820c3320e3a97 /src/builder | |
| parent | Have `ConnectionStage` derive Copy (diff) | |
| download | serenity-0ce8be869eeb2eb700e22f71b2e00872cc96a500.tar.xz serenity-0ce8be869eeb2eb700e22f71b2e00872cc96a500.zip | |
`to_owned` -> `to_string`
Diffstat (limited to 'src/builder')
| -rw-r--r-- | src/builder/create_embed.rs | 54 | ||||
| -rw-r--r-- | src/builder/create_invite.rs | 10 | ||||
| -rw-r--r-- | src/builder/create_message.rs | 8 | ||||
| -rw-r--r-- | src/builder/edit_channel.rs | 10 | ||||
| -rw-r--r-- | src/builder/edit_guild.rs | 20 | ||||
| -rw-r--r-- | src/builder/edit_member.rs | 10 | ||||
| -rw-r--r-- | src/builder/edit_profile.rs | 14 | ||||
| -rw-r--r-- | src/builder/edit_role.rs | 40 | ||||
| -rw-r--r-- | src/builder/execute_webhook.rs | 14 | ||||
| -rw-r--r-- | src/builder/get_messages.rs | 8 |
10 files changed, 94 insertions, 94 deletions
diff --git a/src/builder/create_embed.rs b/src/builder/create_embed.rs index 1e0bc8d..a128c91 100644 --- a/src/builder/create_embed.rs +++ b/src/builder/create_embed.rs @@ -50,7 +50,7 @@ impl CreateEmbed { where F: FnOnce(CreateEmbedAuthor) -> CreateEmbedAuthor { let author = f(CreateEmbedAuthor::default()).0; - self.0.insert("author".to_owned(), Value::Object(author)); + self.0.insert("author".to_string(), Value::Object(author)); CreateEmbed(self.0) } @@ -68,7 +68,7 @@ impl CreateEmbed { #[cfg(feature = "utils")] pub fn colour<C: Into<Colour>>(mut self, colour: C) -> Self { self.0.insert( - "color".to_owned(), + "color".to_string(), Value::Number(Number::from(colour.into().0 as u64)), ); @@ -88,7 +88,7 @@ impl CreateEmbed { #[cfg(not(feature = "utils"))] pub fn colour(mut self, colour: u32) -> Self { self.0 - .insert("color".to_owned(), Value::Number(Number::from(colour))); + .insert("color".to_string(), Value::Number(Number::from(colour))); CreateEmbed(self.0) } @@ -98,7 +98,7 @@ impl CreateEmbed { /// **Note**: This can't be longer than 2048 characters. pub fn description<D: Display>(mut self, description: D) -> Self { self.0.insert( - "description".to_owned(), + "description".to_string(), Value::String(format!("{}", description)), ); @@ -120,7 +120,7 @@ impl CreateEmbed { let field = f(CreateEmbedField::default()).0; { - let key = "fields".to_owned(); + let key = "fields".to_string(); let entry = self.0.remove(&key).unwrap_or_else(|| Value::Array(vec![])); let mut arr = match entry { @@ -136,7 +136,7 @@ impl CreateEmbed { }; arr.push(Value::Object(field)); - self.0.insert("fields".to_owned(), Value::Array(arr)); + self.0.insert("fields".to_string(), Value::Array(arr)); } CreateEmbed(self.0) @@ -150,7 +150,7 @@ impl CreateEmbed { .collect::<Vec<Value>>(); { - let key = "fields".to_owned(); + let key = "fields".to_string(); let entry = self.0.remove(&key).unwrap_or_else(|| Value::Array(vec![])); let mut arr = match entry { @@ -159,7 +159,7 @@ impl CreateEmbed { }; arr.extend(fields); - self.0.insert("fields".to_owned(), Value::Array(arr)); + self.0.insert("fields".to_string(), Value::Array(arr)); } CreateEmbed(self.0) @@ -175,7 +175,7 @@ impl CreateEmbed { where F: FnOnce(CreateEmbedFooter) -> CreateEmbedFooter { let footer = f(CreateEmbedFooter::default()).0; - self.0.insert("footer".to_owned(), Value::Object(footer)); + self.0.insert("footer".to_string(), Value::Object(footer)); CreateEmbed(self.0) } @@ -183,10 +183,10 @@ impl CreateEmbed { /// Set the image associated with the embed. This only supports HTTP(S). pub fn image(mut self, url: &str) -> Self { let image = json!({ - "url": url.to_owned() + "url": url.to_string() }); - self.0.insert("image".to_owned(), image); + self.0.insert("image".to_string(), image); CreateEmbed(self.0) } @@ -194,10 +194,10 @@ impl CreateEmbed { /// Set the thumbnail of the embed. This only supports HTTP(S). pub fn thumbnail(mut self, url: &str) -> Self { let thumbnail = json!({ - "url": url.to_owned(), + "url": url.to_string(), }); - self.0.insert("thumbnail".to_owned(), thumbnail); + self.0.insert("thumbnail".to_string(), thumbnail); CreateEmbed(self.0) } @@ -283,7 +283,7 @@ impl CreateEmbed { /// ``` pub fn timestamp<T: Into<Timestamp>>(mut self, timestamp: T) -> Self { self.0 - .insert("timestamp".to_owned(), Value::String(timestamp.into().ts)); + .insert("timestamp".to_string(), Value::String(timestamp.into().ts)); CreateEmbed(self.0) } @@ -291,7 +291,7 @@ impl CreateEmbed { /// Set the title of the embed. pub fn title<D: Display>(mut self, title: D) -> Self { self.0 - .insert("title".to_owned(), Value::String(format!("{}", title))); + .insert("title".to_string(), Value::String(format!("{}", title))); CreateEmbed(self.0) } @@ -299,7 +299,7 @@ impl CreateEmbed { /// Set the URL to direct to when clicking on the title. pub fn url(mut self, url: &str) -> Self { self.0 - .insert("url".to_owned(), Value::String(url.to_owned())); + .insert("url".to_string(), Value::String(url.to_string())); CreateEmbed(self.0) } @@ -319,7 +319,7 @@ impl Default for CreateEmbed { /// Creates a builder with default values, setting the `type` to `rich`. fn default() -> CreateEmbed { let mut map = Map::new(); - map.insert("type".to_owned(), Value::String("rich".to_owned())); + map.insert("type".to_string(), Value::String("rich".to_string())); CreateEmbed(map) } @@ -397,7 +397,7 @@ impl CreateEmbedAuthor { /// Set the URL of the author's icon. pub fn icon_url(mut self, icon_url: &str) -> Self { self.0 - .insert("icon_url".to_owned(), Value::String(icon_url.to_owned())); + .insert("icon_url".to_string(), Value::String(icon_url.to_string())); self } @@ -405,7 +405,7 @@ impl CreateEmbedAuthor { /// Set the author's name. pub fn name(mut self, name: &str) -> Self { self.0 - .insert("name".to_owned(), Value::String(name.to_owned())); + .insert("name".to_string(), Value::String(name.to_string())); self } @@ -413,7 +413,7 @@ impl CreateEmbedAuthor { /// Set the author's URL. pub fn url(mut self, url: &str) -> Self { self.0 - .insert("url".to_owned(), Value::String(url.to_owned())); + .insert("url".to_string(), Value::String(url.to_string())); self } @@ -433,7 +433,7 @@ pub struct CreateEmbedField(pub Map<String, Value>); impl CreateEmbedField { /// Set whether the field is inlined. Set to true by default. pub fn inline(mut self, inline: bool) -> Self { - self.0.insert("inline".to_owned(), Value::Bool(inline)); + self.0.insert("inline".to_string(), Value::Bool(inline)); self } @@ -441,7 +441,7 @@ impl CreateEmbedField { /// Set the field's name. It can't be longer than 256 characters. pub fn name<D: Display>(mut self, name: D) -> Self { self.0 - .insert("name".to_owned(), Value::String(format!("{}", name))); + .insert("name".to_string(), Value::String(format!("{}", name))); self } @@ -449,7 +449,7 @@ impl CreateEmbedField { /// Set the field's value. It can't be longer than 1024 characters. pub fn value<D: Display>(mut self, value: D) -> Self { self.0 - .insert("value".to_owned(), Value::String(format!("{}", value))); + .insert("value".to_string(), Value::String(format!("{}", value))); self } @@ -460,7 +460,7 @@ impl Default for CreateEmbedField { /// `true`. fn default() -> CreateEmbedField { let mut map = Map::new(); - map.insert("inline".to_owned(), Value::Bool(true)); + map.insert("inline".to_string(), Value::Bool(true)); CreateEmbedField(map) } @@ -480,7 +480,7 @@ impl CreateEmbedFooter { /// Set the icon URL's value. This only supports HTTP(S). pub fn icon_url(mut self, icon_url: &str) -> Self { self.0 - .insert("icon_url".to_owned(), Value::String(icon_url.to_owned())); + .insert("icon_url".to_string(), Value::String(icon_url.to_string())); self } @@ -488,7 +488,7 @@ impl CreateEmbedFooter { /// Set the footer's text. pub fn text<D: Display>(mut self, text: D) -> Self { self.0 - .insert("text".to_owned(), Value::String(format!("{}", text))); + .insert("text".to_string(), Value::String(format!("{}", text))); self } @@ -510,7 +510,7 @@ impl From<String> for Timestamp { impl<'a> From<&'a str> for Timestamp { fn from(ts: &'a str) -> Self { Timestamp { - ts: ts.to_owned(), + ts: ts.to_string(), } } } diff --git a/src/builder/create_invite.rs b/src/builder/create_invite.rs index 58893fc..5f4f0bf 100644 --- a/src/builder/create_invite.rs +++ b/src/builder/create_invite.rs @@ -90,7 +90,7 @@ impl CreateInvite { /// ``` pub fn max_age(mut self, max_age: u64) -> Self { self.0 - .insert("max_age".to_owned(), Value::Number(Number::from(max_age))); + .insert("max_age".to_string(), Value::Number(Number::from(max_age))); self } @@ -124,7 +124,7 @@ impl CreateInvite { /// ``` pub fn max_uses(mut self, max_uses: u64) -> Self { self.0 - .insert("max_uses".to_owned(), Value::Number(Number::from(max_uses))); + .insert("max_uses".to_string(), Value::Number(Number::from(max_uses))); self } @@ -156,7 +156,7 @@ impl CreateInvite { /// ``` pub fn temporary(mut self, temporary: bool) -> Self { self.0 - .insert("temporary".to_owned(), Value::Bool(temporary)); + .insert("temporary".to_string(), Value::Bool(temporary)); self } @@ -187,7 +187,7 @@ impl CreateInvite { /// # } /// ``` pub fn unique(mut self, unique: bool) -> Self { - self.0.insert("unique".to_owned(), Value::Bool(unique)); + self.0.insert("unique".to_string(), Value::Bool(unique)); self } @@ -207,7 +207,7 @@ impl Default for CreateInvite { /// ``` fn default() -> CreateInvite { let mut map = Map::new(); - map.insert("validate".to_owned(), Value::Null); + map.insert("validate".to_string(), Value::Null); CreateInvite(map) } diff --git a/src/builder/create_message.rs b/src/builder/create_message.rs index dea77e1..96bad82 100644 --- a/src/builder/create_message.rs +++ b/src/builder/create_message.rs @@ -47,7 +47,7 @@ impl CreateMessage { /// **Note**: Message contents must be under 2000 unicode code points. pub fn content<D: Display>(mut self, content: D) -> Self { self.0 - .insert("content".to_owned(), Value::String(format!("{}", content))); + .insert("content".to_string(), Value::String(format!("{}", content))); CreateMessage(self.0, self.1) } @@ -57,7 +57,7 @@ impl CreateMessage { where F: FnOnce(CreateEmbed) -> CreateEmbed { let embed = Value::Object(f(CreateEmbed::default()).0); - self.0.insert("embed".to_owned(), embed); + self.0.insert("embed".to_string(), embed); CreateMessage(self.0, self.1) } @@ -68,7 +68,7 @@ impl CreateMessage { /// /// Defaults to `false`. pub fn tts(mut self, tts: bool) -> Self { - self.0.insert("tts".to_owned(), Value::Bool(tts)); + self.0.insert("tts".to_string(), Value::Bool(tts)); CreateMessage(self.0, self.1) } @@ -89,7 +89,7 @@ impl Default for CreateMessage { /// [`tts`]: #method.tts fn default() -> CreateMessage { let mut map = Map::default(); - map.insert("tts".to_owned(), Value::Bool(false)); + map.insert("tts".to_string(), Value::Bool(false)); CreateMessage(map, None) } diff --git a/src/builder/edit_channel.rs b/src/builder/edit_channel.rs index e3bf78e..1ed1551 100644 --- a/src/builder/edit_channel.rs +++ b/src/builder/edit_channel.rs @@ -28,7 +28,7 @@ impl EditChannel { /// [voice]: ../model/enum.ChannelType.html#variant.Voice pub fn bitrate(mut self, bitrate: u64) -> Self { self.0 - .insert("bitrate".to_owned(), Value::Number(Number::from(bitrate))); + .insert("bitrate".to_string(), Value::Number(Number::from(bitrate))); self } @@ -38,7 +38,7 @@ impl EditChannel { /// Must be between 2 and 100 characters long. pub fn name(mut self, name: &str) -> Self { self.0 - .insert("name".to_owned(), Value::String(name.to_owned())); + .insert("name".to_string(), Value::String(name.to_string())); self } @@ -46,7 +46,7 @@ impl EditChannel { /// The position of the channel in the channel list. pub fn position(mut self, position: u64) -> Self { self.0 - .insert("position".to_owned(), Value::Number(Number::from(position))); + .insert("position".to_string(), Value::Number(Number::from(position))); self } @@ -60,7 +60,7 @@ impl EditChannel { /// [text]: ../model/enum.ChannelType.html#variant.Text pub fn topic(mut self, topic: &str) -> Self { self.0 - .insert("topic".to_owned(), Value::String(topic.to_owned())); + .insert("topic".to_string(), Value::String(topic.to_string())); self } @@ -72,7 +72,7 @@ impl EditChannel { /// [voice]: ../model/enum.ChannelType.html#variant.Voice pub fn user_limit(mut self, user_limit: u64) -> Self { self.0.insert( - "user_limit".to_owned(), + "user_limit".to_string(), Value::Number(Number::from(user_limit)), ); diff --git a/src/builder/edit_guild.rs b/src/builder/edit_guild.rs index f88db2a..0719305 100644 --- a/src/builder/edit_guild.rs +++ b/src/builder/edit_guild.rs @@ -24,7 +24,7 @@ impl EditGuild { /// [`afk_timeout`]: #method.afk_timeout pub fn afk_channel<C: Into<ChannelId>>(mut self, channel: Option<C>) -> Self { self.0.insert( - "afk_channel_id".to_owned(), + "afk_channel_id".to_string(), match channel { Some(channel) => Value::Number(Number::from(channel.into().0)), None => Value::Null, @@ -40,7 +40,7 @@ impl EditGuild { /// [`afk_channel`]: #method.afk_channel pub fn afk_timeout(mut self, timeout: u64) -> Self { self.0.insert( - "afk_timeout".to_owned(), + "afk_timeout".to_string(), Value::Number(Number::from(timeout)), ); @@ -78,8 +78,8 @@ impl EditGuild { /// [`utils::read_image`]: ../utils/fn.read_image.html pub fn icon(mut self, icon: Option<&str>) -> Self { self.0.insert( - "icon".to_owned(), - icon.map_or_else(|| Value::Null, |x| Value::String(x.to_owned())), + "icon".to_string(), + icon.map_or_else(|| Value::Null, |x| Value::String(x.to_string())), ); self @@ -90,7 +90,7 @@ impl EditGuild { /// **Note**: Must be between (and including) 2-100 chracters. pub fn name(mut self, name: &str) -> Self { self.0 - .insert("name".to_owned(), Value::String(name.to_owned())); + .insert("name".to_string(), Value::String(name.to_string())); self } @@ -100,7 +100,7 @@ impl EditGuild { /// **Note**: The current user must be the owner of the guild. pub fn owner<U: Into<UserId>>(mut self, user_id: U) -> Self { self.0.insert( - "owner_id".to_owned(), + "owner_id".to_string(), Value::Number(Number::from(user_id.into().0)), ); @@ -135,7 +135,7 @@ impl EditGuild { /// [`Region::UsWest`]: ../model/enum.Region.html#variant.UsWest pub fn region(mut self, region: Region) -> Self { self.0 - .insert("region".to_owned(), Value::String(region.name().to_owned())); + .insert("region".to_string(), Value::String(region.name().to_string())); self } @@ -148,9 +148,9 @@ impl EditGuild { /// [`InviteSplash`]: ../model/enum.Feature.html#variant.InviteSplash /// [`features`]: ../model/struct.LiveGuild.html#structfield.features pub fn splash(mut self, splash: Option<&str>) -> Self { - let splash = splash.map_or(Value::Null, |x| Value::String(x.to_owned())); + let splash = splash.map_or(Value::Null, |x| Value::String(x.to_string())); - self.0.insert("splash".to_owned(), splash); + self.0.insert("splash".to_string(), splash); self } @@ -189,7 +189,7 @@ impl EditGuild { where V: Into<VerificationLevel> { let num = Value::Number(Number::from(verification_level.into().num())); - self.0.insert("verification_level".to_owned(), num); + self.0.insert("verification_level".to_string(), num); self } diff --git a/src/builder/edit_member.rs b/src/builder/edit_member.rs index 23bf1f2..e450669 100644 --- a/src/builder/edit_member.rs +++ b/src/builder/edit_member.rs @@ -16,7 +16,7 @@ impl EditMember { /// /// [Deafen Members]: ../model/permissions/constant.DEAFEN_MEMBERS.html pub fn deafen(mut self, deafen: bool) -> Self { - self.0.insert("deaf".to_owned(), Value::Bool(deafen)); + self.0.insert("deaf".to_string(), Value::Bool(deafen)); self } @@ -27,7 +27,7 @@ impl EditMember { /// /// [Mute Members]: ../model/permissions/constant.MUTE_MEMBERS.html pub fn mute(mut self, mute: bool) -> Self { - self.0.insert("mute".to_owned(), Value::Bool(mute)); + self.0.insert("mute".to_string(), Value::Bool(mute)); self } @@ -40,7 +40,7 @@ impl EditMember { /// [Manage Nicknames]: ../model/permissions/constant.MANAGE_NICKNAMES.html pub fn nickname(mut self, nickname: &str) -> Self { self.0 - .insert("nick".to_owned(), Value::String(nickname.to_owned())); + .insert("nick".to_string(), Value::String(nickname.to_string())); self } @@ -56,7 +56,7 @@ impl EditMember { .map(|x| Value::Number(Number::from(x.0))) .collect(); - self.0.insert("roles".to_owned(), Value::Array(role_ids)); + self.0.insert("roles".to_string(), Value::Array(role_ids)); self } @@ -68,7 +68,7 @@ impl EditMember { /// [Move Members]: ../model/permissions/constant.MOVE_MEMBERS.html pub fn voice_channel<C: Into<ChannelId>>(mut self, channel_id: C) -> Self { self.0.insert( - "channel_id".to_owned(), + "channel_id".to_string(), Value::Number(Number::from(channel_id.into().0)), ); diff --git a/src/builder/edit_profile.rs b/src/builder/edit_profile.rs index 6aa4e78..ae0bbd5 100644 --- a/src/builder/edit_profile.rs +++ b/src/builder/edit_profile.rs @@ -43,9 +43,9 @@ impl EditProfile { /// /// [`utils::read_image`]: ../fn.read_image.html pub fn avatar(mut self, avatar: Option<&str>) -> Self { - let avatar = avatar.map_or(Value::Null, |x| Value::String(x.to_owned())); + let avatar = avatar.map_or(Value::Null, |x| Value::String(x.to_string())); - self.0.insert("avatar".to_owned(), avatar); + self.0.insert("avatar".to_string(), avatar); self } @@ -62,7 +62,7 @@ impl EditProfile { /// [provided]: #method.password pub fn email(mut self, email: &str) -> Self { self.0 - .insert("email".to_owned(), Value::String(email.to_owned())); + .insert("email".to_string(), Value::String(email.to_string())); self } @@ -75,8 +75,8 @@ impl EditProfile { /// [provided]: #method.password pub fn new_password(mut self, new_password: &str) -> Self { self.0.insert( - "new_password".to_owned(), - Value::String(new_password.to_owned()), + "new_password".to_string(), + Value::String(new_password.to_string()), ); self @@ -89,7 +89,7 @@ impl EditProfile { /// [modifying the associated email address]: #method.email pub fn password(mut self, password: &str) -> Self { self.0 - .insert("password".to_owned(), Value::String(password.to_owned())); + .insert("password".to_string(), Value::String(password.to_string())); self } @@ -102,7 +102,7 @@ impl EditProfile { /// an error will occur. pub fn username(mut self, username: &str) -> Self { self.0 - .insert("username".to_owned(), Value::String(username.to_owned())); + .insert("username".to_string(), Value::String(username.to_string())); self } diff --git a/src/builder/edit_role.rs b/src/builder/edit_role.rs index 8be3404..0ef1b35 100644 --- a/src/builder/edit_role.rs +++ b/src/builder/edit_role.rs @@ -51,26 +51,26 @@ impl EditRole { #[cfg(feature = "utils")] { map.insert( - "color".to_owned(), + "color".to_string(), Value::Number(Number::from(role.colour.0)), ); } #[cfg(not(feature = "utils"))] { - map.insert("color".to_owned(), Value::Number(Number::from(role.colour))); + map.insert("color".to_string(), Value::Number(Number::from(role.colour))); } - map.insert("hoist".to_owned(), Value::Bool(role.hoist)); - map.insert("managed".to_owned(), Value::Bool(role.managed)); - map.insert("mentionable".to_owned(), Value::Bool(role.mentionable)); - map.insert("name".to_owned(), Value::String(role.name.clone())); + map.insert("hoist".to_string(), Value::Bool(role.hoist)); + map.insert("managed".to_string(), Value::Bool(role.managed)); + map.insert("mentionable".to_string(), Value::Bool(role.mentionable)); + map.insert("name".to_string(), Value::String(role.name.clone())); map.insert( - "permissions".to_owned(), + "permissions".to_string(), Value::Number(Number::from(role.permissions.bits())), ); map.insert( - "position".to_owned(), + "position".to_string(), Value::Number(Number::from(role.position)), ); @@ -80,7 +80,7 @@ impl EditRole { /// Sets the colour of the role. pub fn colour(mut self, colour: u64) -> Self { self.0 - .insert("color".to_owned(), Value::Number(Number::from(colour))); + .insert("color".to_string(), Value::Number(Number::from(colour))); self } @@ -88,7 +88,7 @@ impl EditRole { /// Whether or not to hoist the role above lower-positioned role in the user /// list. pub fn hoist(mut self, hoist: bool) -> Self { - self.0.insert("hoist".to_owned(), Value::Bool(hoist)); + self.0.insert("hoist".to_string(), Value::Bool(hoist)); self } @@ -96,7 +96,7 @@ impl EditRole { /// Whether or not to make the role mentionable, notifying its users. pub fn mentionable(mut self, mentionable: bool) -> Self { self.0 - .insert("mentionable".to_owned(), Value::Bool(mentionable)); + .insert("mentionable".to_string(), Value::Bool(mentionable)); self } @@ -104,7 +104,7 @@ impl EditRole { /// The name of the role to set. pub fn name(mut self, name: &str) -> Self { self.0 - .insert("name".to_owned(), Value::String(name.to_owned())); + .insert("name".to_string(), Value::String(name.to_string())); self } @@ -112,7 +112,7 @@ impl EditRole { /// The set of permissions to assign the role. pub fn permissions(mut self, permissions: Permissions) -> Self { self.0.insert( - "permissions".to_owned(), + "permissions".to_string(), Value::Number(Number::from(permissions.bits())), ); @@ -123,7 +123,7 @@ impl EditRole { /// role's position in the user list. pub fn position(mut self, position: u8) -> Self { self.0 - .insert("position".to_owned(), Value::Number(Number::from(position))); + .insert("position".to_string(), Value::Number(Number::from(position))); self } @@ -146,12 +146,12 @@ impl Default for EditRole { let mut map = Map::new(); let permissions = Number::from(permissions::PRESET_GENERAL.bits()); - map.insert("color".to_owned(), Value::Number(Number::from(10_070_709))); - map.insert("hoist".to_owned(), Value::Bool(false)); - map.insert("mentionable".to_owned(), Value::Bool(false)); - map.insert("name".to_owned(), Value::String("new role".to_owned())); - map.insert("permissions".to_owned(), Value::Number(permissions)); - map.insert("position".to_owned(), Value::Number(Number::from(1))); + map.insert("color".to_string(), Value::Number(Number::from(10_070_709))); + map.insert("hoist".to_string(), Value::Bool(false)); + map.insert("mentionable".to_string(), Value::Bool(false)); + map.insert("name".to_string(), Value::String("new role".to_string())); + map.insert("permissions".to_string(), Value::Number(permissions)); + map.insert("position".to_string(), Value::Number(Number::from(1))); EditRole(map) } diff --git a/src/builder/execute_webhook.rs b/src/builder/execute_webhook.rs index 0cb276c..ba1668e 100644 --- a/src/builder/execute_webhook.rs +++ b/src/builder/execute_webhook.rs @@ -75,8 +75,8 @@ impl ExecuteWebhook { /// ``` pub fn avatar_url(mut self, avatar_url: &str) -> Self { self.0.insert( - "avatar_url".to_owned(), - Value::String(avatar_url.to_owned()), + "avatar_url".to_string(), + Value::String(avatar_url.to_string()), ); self @@ -104,7 +104,7 @@ impl ExecuteWebhook { /// [`embeds`]: #method.embeds pub fn content(mut self, content: &str) -> Self { self.0 - .insert("content".to_owned(), Value::String(content.to_owned())); + .insert("content".to_string(), Value::String(content.to_string())); self } @@ -123,7 +123,7 @@ impl ExecuteWebhook { /// [`Webhook::execute`]: ../model/struct.Webhook.html#method.execute /// [struct-level documentation]: #examples pub fn embeds(mut self, embeds: Vec<Value>) -> Self { - self.0.insert("embeds".to_owned(), Value::Array(embeds)); + self.0.insert("embeds".to_string(), Value::Array(embeds)); self } @@ -144,7 +144,7 @@ impl ExecuteWebhook { /// } /// ``` pub fn tts(mut self, tts: bool) -> Self { - self.0.insert("tts".to_owned(), Value::Bool(tts)); + self.0.insert("tts".to_string(), Value::Bool(tts)); self } @@ -166,7 +166,7 @@ impl ExecuteWebhook { /// ``` pub fn username(mut self, username: &str) -> Self { self.0 - .insert("username".to_owned(), Value::String(username.to_owned())); + .insert("username".to_string(), Value::String(username.to_string())); self } @@ -191,7 +191,7 @@ impl Default for ExecuteWebhook { /// [`tts`]: #method.tts fn default() -> ExecuteWebhook { let mut map = Map::new(); - map.insert("tts".to_owned(), Value::Bool(false)); + map.insert("tts".to_string(), Value::Bool(false)); ExecuteWebhook(map) } diff --git a/src/builder/get_messages.rs b/src/builder/get_messages.rs index bca2f0e..71af9e5 100644 --- a/src/builder/get_messages.rs +++ b/src/builder/get_messages.rs @@ -56,7 +56,7 @@ impl GetMessages { /// Indicates to retrieve the messages after a specific message, given by /// its Id. pub fn after<M: Into<MessageId>>(mut self, message_id: M) -> Self { - self.0.insert("after".to_owned(), message_id.into().0); + self.0.insert("after".to_string(), message_id.into().0); self } @@ -64,7 +64,7 @@ impl GetMessages { /// Indicates to retrieve the messages _around_ a specific message in either /// direction (before+after) the given message. pub fn around<M: Into<MessageId>>(mut self, message_id: M) -> Self { - self.0.insert("around".to_owned(), message_id.into().0); + self.0.insert("around".to_string(), message_id.into().0); self } @@ -72,7 +72,7 @@ impl GetMessages { /// Indicates to retrieve the messages before a specific message, given by /// its Id. pub fn before<M: Into<MessageId>>(mut self, message_id: M) -> Self { - self.0.insert("before".to_owned(), message_id.into().0); + self.0.insert("before".to_string(), message_id.into().0); self } @@ -86,7 +86,7 @@ impl GetMessages { /// reduced. pub fn limit(mut self, limit: u64) -> Self { self.0 - .insert("limit".to_owned(), if limit > 100 { 100 } else { limit }); + .insert("limit".to_string(), if limit > 100 { 100 } else { limit }); self } |