aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-10-01 21:59:33 +0200
committerZeyla Hellyer <[email protected]>2017-10-09 15:46:37 -0700
commit0ce8be869eeb2eb700e22f71b2e00872cc96a500 (patch)
tree03dd981bc04ba8475333d057705820c3320e3a97 /src
parentHave `ConnectionStage` derive Copy (diff)
downloadserenity-0ce8be869eeb2eb700e22f71b2e00872cc96a500.tar.xz
serenity-0ce8be869eeb2eb700e22f71b2e00872cc96a500.zip
`to_owned` -> `to_string`
Diffstat (limited to 'src')
-rw-r--r--src/builder/create_embed.rs54
-rw-r--r--src/builder/create_invite.rs10
-rw-r--r--src/builder/create_message.rs8
-rw-r--r--src/builder/edit_channel.rs10
-rw-r--r--src/builder/edit_guild.rs20
-rw-r--r--src/builder/edit_member.rs10
-rw-r--r--src/builder/edit_profile.rs14
-rw-r--r--src/builder/edit_role.rs40
-rw-r--r--src/builder/execute_webhook.rs14
-rw-r--r--src/builder/get_messages.rs8
-rw-r--r--src/client/context.rs10
-rw-r--r--src/client/mod.rs2
-rw-r--r--src/framework/standard/configuration.rs6
-rw-r--r--src/framework/standard/create_command.rs14
-rw-r--r--src/framework/standard/create_group.rs12
-rw-r--r--src/framework/standard/help_commands.rs4
-rw-r--r--src/framework/standard/mod.rs16
-rw-r--r--src/gateway/shard.rs14
-rw-r--r--src/http/mod.rs12
-rw-r--r--src/model/channel/channel_category.rs8
-rw-r--r--src/model/channel/guild_channel.rs8
-rw-r--r--src/model/channel/message.rs2
-rw-r--r--src/model/channel/reaction.rs2
-rw-r--r--src/model/event.rs2
-rw-r--r--src/model/gateway.rs6
-rw-r--r--src/model/guild/guild_id.rs2
-rw-r--r--src/model/guild/mod.rs4
-rw-r--r--src/model/invite.rs14
-rw-r--r--src/model/user.rs4
-rw-r--r--src/model/webhook.rs6
-rw-r--r--src/utils/colour.rs2
-rw-r--r--src/utils/message_builder.rs4
-rw-r--r--src/utils/mod.rs8
-rw-r--r--src/voice/handler.rs2
34 files changed, 176 insertions, 176 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
}
diff --git a/src/client/context.rs b/src/client/context.rs
index 31eeca5..2288f28 100644
--- a/src/client/context.rs
+++ b/src/client/context.rs
@@ -85,18 +85,18 @@ impl Context {
{
let cache = CACHE.read().unwrap();
- map.insert("username".to_owned(), Value::String(cache.user.name.clone()));
+ map.insert("username".to_string(), Value::String(cache.user.name.clone()));
if let Some(email) = cache.user.email.as_ref() {
- map.insert("email".to_owned(), Value::String(email.clone()));
+ map.insert("email".to_string(), Value::String(email.clone()));
}
} else {
let user = http::get_current_user()?;
- map.insert("username".to_owned(), Value::String(user.name.clone()));
+ map.insert("username".to_string(), Value::String(user.name.clone()));
if let Some(email) = user.email.as_ref() {
- map.insert("email".to_owned(), Value::String(email.clone()));
+ map.insert("email".to_string(), Value::String(email.clone()));
}
}
}
@@ -328,7 +328,7 @@ impl Context {
pub fn set_game_name(&self, game_name: &str) {
let game = Game {
kind: GameType::Playing,
- name: game_name.to_owned(),
+ name: game_name.to_string(),
url: None,
};
diff --git a/src/client/mod.rs b/src/client/mod.rs
index f497f2c..d1de13e 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -279,7 +279,7 @@ impl<H: EventHandler + Send + Sync + 'static> Client<H> {
/// ```
pub fn new(token: &str, handler: H) -> Self {
let token = if token.starts_with("Bot ") {
- token.to_owned()
+ token.to_string()
} else {
format!("Bot {}", token)
};
diff --git a/src/framework/standard/configuration.rs b/src/framework/standard/configuration.rs
index 58861bb..8112319 100644
--- a/src/framework/standard/configuration.rs
+++ b/src/framework/standard/configuration.rs
@@ -164,7 +164,7 @@ impl Configuration {
/// # let mut client = Client::new("token", Handler);
/// use serenity::framework::StandardFramework;
///
- /// let disabled = vec!["ping"].into_iter().map(|x| x.to_owned()).collect();
+ /// let disabled = vec!["ping"].into_iter().map(|x| x.to_string()).collect();
///
/// client.with_framework(StandardFramework::new()
/// .command("ping", |c| c.exec_str("pong!"))
@@ -201,7 +201,7 @@ impl Configuration {
/// "!"
/// } else {
/// "~"
- /// }.to_owned())
+ /// }.to_string())
/// })));
/// ```
pub fn dynamic_prefix<F>(mut self, dynamic_prefix: F) -> Self
@@ -328,7 +328,7 @@ impl Configuration {
/// .prefix("!")));
/// ```
pub fn prefix(mut self, prefix: &str) -> Self {
- self.prefixes = vec![prefix.to_owned()];
+ self.prefixes = vec![prefix.to_string()];
self
}
diff --git a/src/framework/standard/create_command.rs b/src/framework/standard/create_command.rs
index 99798ca..40877b9 100644
--- a/src/framework/standard/create_command.rs
+++ b/src/framework/standard/create_command.rs
@@ -12,14 +12,14 @@ impl CreateCommand {
pub fn batch_known_as(mut self, names: Vec<&str>) -> Self {
self.0
.aliases
- .extend(names.into_iter().map(|n| n.to_owned()));
+ .extend(names.into_iter().map(|n| n.to_string()));
self
}
/// Adds a ratelimit bucket.
pub fn bucket(mut self, bucket: &str) -> Self {
- self.0.bucket = Some(bucket.to_owned());
+ self.0.bucket = Some(bucket.to_string());
self
}
@@ -81,7 +81,7 @@ impl CreateCommand {
/// Description, used by other commands.
pub fn desc(mut self, desc: &str) -> Self {
- self.0.desc = Some(desc.to_owned());
+ self.0.desc = Some(desc.to_string());
self
}
@@ -95,7 +95,7 @@ impl CreateCommand {
/// Example arguments, used by other commands.
pub fn example(mut self, example: &str) -> Self {
- self.0.example = Some(example.to_owned());
+ self.0.example = Some(example.to_string());
self
}
@@ -137,7 +137,7 @@ impl CreateCommand {
/// .command("ping", |c| c.exec_str("Pong!")));
/// ```
pub fn exec_str(mut self, content: &str) -> Self {
- self.0.exec = CommandType::StringResponse(content.to_owned());
+ self.0.exec = CommandType::StringResponse(content.to_string());
self
}
@@ -158,7 +158,7 @@ impl CreateCommand {
/// Adds an alias, allowing users to use the command under a different name.
pub fn known_as(mut self, name: &str) -> Self {
- self.0.aliases.push(name.to_owned());
+ self.0.aliases.push(name.to_string());
self
}
@@ -202,7 +202,7 @@ impl CreateCommand {
/// Command usage schema, used by other commands.
pub fn usage(mut self, usage: &str) -> Self {
- self.0.usage = Some(usage.to_owned());
+ self.0.usage = Some(usage.to_string());
self
}
diff --git a/src/framework/standard/create_group.rs b/src/framework/standard/create_group.rs
index 15db5a4..1d6d49c 100644
--- a/src/framework/standard/create_group.rs
+++ b/src/framework/standard/create_group.rs
@@ -50,19 +50,19 @@ impl CreateGroup {
for n in &cmd.aliases {
if let Some(ref prefix) = self.0.prefix {
self.0.commands.insert(
- format!("{} {}", prefix, n.to_owned()),
+ format!("{} {}", prefix, n.to_string()),
CommandOrAlias::Alias(format!("{} {}", prefix, command_name.to_string())),
);
} else {
self.0.commands.insert(
- n.to_owned(),
+ n.to_string(),
CommandOrAlias::Alias(command_name.to_string()),
);
}
}
self.0.commands.insert(
- command_name.to_owned(),
+ command_name.to_string(),
CommandOrAlias::Command(Arc::new(cmd)),
);
@@ -71,7 +71,7 @@ impl CreateGroup {
/// Adds a command to group with simplified API.
/// You can return Err(From::from(string)) if there's an error.
- pub fn on(mut self, name: &str,
+ pub fn on(mut self, name: &str,
f: fn(&mut Context, &Message, Args) -> Result<(), CommandError>) -> Self {
let cmd = Arc::new(Command::new(f));
@@ -90,14 +90,14 @@ impl CreateGroup {
///
/// **Note**: It's suggested to call this first when making a group.
pub fn prefix(mut self, desc: &str) -> Self {
- self.0.prefix = Some(desc.to_owned());
+ self.0.prefix = Some(desc.to_string());
self
}
/// Adds a ratelimit bucket.
pub fn bucket(mut self, bucket: &str) -> Self {
- self.0.bucket = Some(bucket.to_owned());
+ self.0.bucket = Some(bucket.to_string());
self
}
diff --git a/src/framework/standard/help_commands.rs b/src/framework/standard/help_commands.rs
index c25b227..f92e3cc 100644
--- a/src/framework/standard/help_commands.rs
+++ b/src/framework/standard/help_commands.rs
@@ -94,7 +94,7 @@ pub fn with_embeds(_: &mut Context,
let with_prefix = if let Some(ref prefix) = group.prefix {
format!("{} {}", prefix, command_name)
} else {
- command_name.to_owned()
+ command_name.to_string()
};
if name == with_prefix || name == *command_name {
@@ -267,7 +267,7 @@ pub fn plain(_: &mut Context,
let with_prefix = if let Some(ref prefix) = group.prefix {
format!("{} {}", prefix, command_name)
} else {
- command_name.to_owned()
+ command_name.to_string()
};
if name == with_prefix || name == *command_name {
diff --git a/src/framework/standard/mod.rs b/src/framework/standard/mod.rs
index 8b73a36..89f8968 100644
--- a/src/framework/standard/mod.rs
+++ b/src/framework/standard/mod.rs
@@ -518,9 +518,9 @@ impl StandardFramework {
.contains(&message.author.id) {
Some(DispatchError::BlockedUser)
} else if self.configuration.disabled_commands.contains(to_check) {
- Some(DispatchError::CommandDisabled(to_check.to_owned()))
+ Some(DispatchError::CommandDisabled(to_check.to_string()))
} else if self.configuration.disabled_commands.contains(built) {
- Some(DispatchError::CommandDisabled(built.to_owned()))
+ Some(DispatchError::CommandDisabled(built.to_string()))
} else {
if !command.allowed_roles.is_empty() {
if let Some(guild) = message.guild() {
@@ -550,7 +550,7 @@ impl StandardFramework {
if all_passed {
None
} else {
- Some(DispatchError::CheckFailed(command.to_owned()))
+ Some(DispatchError::CheckFailed(command.clone()))
}
}
}
@@ -601,7 +601,7 @@ impl StandardFramework {
-> Result<(), CommandError>) -> Self {
{
let ungrouped = self.groups
- .entry("Ungrouped".to_owned())
+ .entry("Ungrouped".to_string())
.or_insert_with(|| Arc::new(CommandGroup::default()));
if let Some(ref mut group) = Arc::get_mut(ungrouped) {
@@ -631,7 +631,7 @@ impl StandardFramework {
where F: FnOnce(CreateCommand) -> CreateCommand, S: Into<String> {
{
let ungrouped = self.groups
- .entry("Ungrouped".to_owned())
+ .entry("Ungrouped".to_string())
.or_insert_with(|| Arc::new(CommandGroup::default()));
if let Some(ref mut group) = Arc::get_mut(ungrouped) {
@@ -649,7 +649,7 @@ impl StandardFramework {
for v in &cmd.aliases {
group
.commands
- .insert(v.to_owned(), CommandOrAlias::Alias(name.clone()));
+ .insert(v.to_string(), CommandOrAlias::Alias(name.clone()));
}
}
@@ -871,12 +871,12 @@ impl Framework for StandardFramework {
let cmd = group.commands.get(&built);
if let Some(&CommandOrAlias::Alias(ref points_to)) = cmd {
- built = points_to.to_owned();
+ built = points_to.to_string();
}
let mut to_check = if let Some(ref prefix) = group.prefix {
if built.starts_with(prefix) && command_length > prefix.len() + 1 {
- built[(prefix.len() + 1)..].to_owned()
+ built[(prefix.len() + 1)..].to_string()
} else {
continue;
}
diff --git a/src/gateway/shard.rs b/src/gateway/shard.rs
index b0d10a1..2781e84 100644
--- a/src/gateway/shard.rs
+++ b/src/gateway/shard.rs
@@ -191,7 +191,7 @@ impl Shard {
/// # use serenity::client::gateway::Shard;
/// # use std::sync::{Arc, Mutex};
/// #
- /// # let mutex = Arc::new(Mutex::new("".to_owned()));
+ /// # let mutex = Arc::new(Mutex::new("".to_string()));
/// #
/// # let shard = Shard::new(mutex.clone(), mutex, [1, 2]).unwrap();
/// #
@@ -221,7 +221,7 @@ impl Shard {
/// # use serenity::client::gateway::Shard;
/// # use std::sync::{Arc, Mutex};
/// #
- /// # let mutex = Arc::new(Mutex::new("".to_owned()));
+ /// # let mutex = Arc::new(Mutex::new("".to_string()));
/// #
/// # let mut shard = Shard::new(mutex.clone(), mutex, [0, 1]).unwrap();
/// #
@@ -250,7 +250,7 @@ impl Shard {
/// # use serenity::client::gateway::Shard;
/// # use std::sync::{Arc, Mutex};
/// #
- /// # let mutex = Arc::new(Mutex::new("".to_owned()));
+ /// # let mutex = Arc::new(Mutex::new("".to_string()));
/// #
/// # let mut shard = Shard::new(mutex.clone(), mutex, [0, 1]).unwrap();
/// #
@@ -285,7 +285,7 @@ impl Shard {
/// # use serenity::client::gateway::Shard;
/// # use std::sync::{Arc, Mutex};
/// #
- /// # let mutex = Arc::new(Mutex::new("".to_owned()));
+ /// # let mutex = Arc::new(Mutex::new("".to_string()));
/// #
/// # let mut shard = Shard::new(mutex.clone(), mutex, [0, 1]).unwrap();
/// #
@@ -638,7 +638,7 @@ impl Shard {
/// # use serenity::client::gateway::Shard;
/// # use std::sync::{Arc, Mutex};
/// #
- /// # let mutex = Arc::new(Mutex::new("".to_owned()));
+ /// # let mutex = Arc::new(Mutex::new("".to_string()));
/// #
/// # let mut shard = Shard::new(mutex.clone(), mutex, [0, 1]).unwrap();
/// #
@@ -656,7 +656,7 @@ impl Shard {
/// # use serenity::client::gateway::Shard;
/// # use std::sync::{Arc, Mutex};
/// #
- /// # let mutex = Arc::new(Mutex::new("".to_owned()));
+ /// # let mutex = Arc::new(Mutex::new("".to_string()));
/// #
/// # let mut shard = Shard::new(mutex.clone(), mutex, [0, 1]).unwrap();
/// #
@@ -701,7 +701,7 @@ impl Shard {
/// # use serenity::client::gateway::Shard;
/// # use std::sync::{Arc, Mutex};
/// #
- /// # let mutex = Arc::new(Mutex::new("will anyone read this".to_owned()));
+ /// # let mutex = Arc::new(Mutex::new("will anyone read this".to_string()));
/// #
/// # let shard = Shard::new(mutex.clone(), mutex, [0, 1]).unwrap();
/// #
diff --git a/src/http/mod.rs b/src/http/mod.rs
index 641d803..4f70dcf 100644
--- a/src/http/mod.rs
+++ b/src/http/mod.rs
@@ -98,7 +98,7 @@ lazy_static! {
/// # fn main() {
/// # try_main().unwrap();
/// # }
-pub fn set_token(token: &str) { TOKEN.lock().unwrap().clone_from(&token.to_owned()); }
+pub fn set_token(token: &str) { TOKEN.lock().unwrap().clone_from(&token.to_string()); }
/// Adds a [`User`] as a recipient to a [`Group`].
///
@@ -1210,7 +1210,7 @@ pub fn get_guild_members(guild_id: u64,
for value in values {
if let Some(element) = value.as_object_mut() {
- element.insert("guild_id".to_owned(), num.clone());
+ element.insert("guild_id".to_string(), num.clone());
}
}
}
@@ -1366,7 +1366,7 @@ pub fn get_member(guild_id: u64, user_id: u64) -> Result<Member> {
let mut v = serde_json::from_reader::<HyperResponse, Value>(response)?;
if let Some(map) = v.as_object_mut() {
- map.insert("guild_id".to_owned(), Value::Number(Number::from(guild_id)));
+ map.insert("guild_id".to_string(), Value::Number(Number::from(guild_id)));
}
serde_json::from_value::<Member>(v).map_err(From::from)
@@ -1627,10 +1627,10 @@ pub fn send_files<'a, T>(channel_id: u64, files: Vec<T>, map: JsonMap) -> Result
.set(header::Authorization(TOKEN.lock().unwrap().clone()));
request
.headers_mut()
- .set(header::UserAgent(constants::USER_AGENT.to_owned()));
+ .set(header::UserAgent(constants::USER_AGENT.to_string()));
let mut request = Multipart::from_request(request)?;
- let mut file_num = "0".to_owned();
+ let mut file_num = "0".to_string();
for file in files {
match file.into() {
@@ -1797,7 +1797,7 @@ fn request<'a, F>(route: Route, f: F) -> Result<HyperResponse>
pub(crate) fn retry<'a, F>(f: F) -> HyperResult<HyperResponse>
where F: Fn() -> RequestBuilder<'a> {
let req = || {
- f().header(header::UserAgent(constants::USER_AGENT.to_owned()))
+ f().header(header::UserAgent(constants::USER_AGENT.to_string()))
.send()
};
diff --git a/src/model/channel/channel_category.rs b/src/model/channel/channel_category.rs
index 50df35e..f567cee 100644
--- a/src/model/channel/channel_category.rs
+++ b/src/model/channel/channel_category.rs
@@ -94,14 +94,14 @@ impl ChannelCategory {
}
let mut map = Map::new();
- map.insert("name".to_owned(), Value::String(self.name.clone()));
+ map.insert("name".to_string(), Value::String(self.name.clone()));
map.insert(
- "position".to_owned(),
+ "position".to_string(),
Value::Number(Number::from(self.position)),
);
map.insert(
- "type".to_owned(),
- Value::String(self.kind.name().to_owned()),
+ "type".to_string(),
+ Value::String(self.kind.name().to_string()),
);
let edited = f(EditChannel(map)).0;
diff --git a/src/model/channel/guild_channel.rs b/src/model/channel/guild_channel.rs
index a6bc597..6cd3b72 100644
--- a/src/model/channel/guild_channel.rs
+++ b/src/model/channel/guild_channel.rs
@@ -313,14 +313,14 @@ impl GuildChannel {
}
let mut map = Map::new();
- map.insert("name".to_owned(), Value::String(self.name.clone()));
+ map.insert("name".to_string(), Value::String(self.name.clone()));
map.insert(
- "position".to_owned(),
+ "position".to_string(),
Value::Number(Number::from(self.position)),
);
map.insert(
- "type".to_owned(),
- Value::String(self.kind.name().to_owned()),
+ "type".to_string(),
+ Value::String(self.kind.name().to_string()),
);
let edited = f(EditChannel(map)).0;
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs
index 7b94540..55f61ba 100644
--- a/src/model/channel/message.rs
+++ b/src/model/channel/message.rs
@@ -257,7 +257,7 @@ impl Message {
self.content = if chosen.contains("$user") {
chosen.replace("$user", &self.author.mention())
} else {
- chosen.to_owned()
+ chosen.to_string()
};
},
_ => {},
diff --git a/src/model/channel/reaction.rs b/src/model/channel/reaction.rs
index 2420ba7..8edc2e9 100644
--- a/src/model/channel/reaction.rs
+++ b/src/model/channel/reaction.rs
@@ -274,7 +274,7 @@ impl<'a> From<&'a str> for ReactionType {
///
/// foo("🍎");
/// ```
- fn from(unicode: &str) -> ReactionType { ReactionType::Unicode(unicode.to_owned()) }
+ fn from(unicode: &str) -> ReactionType { ReactionType::Unicode(unicode.to_string()) }
}
impl Display for ReactionType {
diff --git a/src/model/event.rs b/src/model/event.rs
index 6e54a25..f729a33 100644
--- a/src/model/event.rs
+++ b/src/model/event.rs
@@ -578,7 +578,7 @@ impl<'de> Deserialize<'de> for GuildMembersChunkEvent {
for member in members {
if let Some(map) = member.as_object_mut() {
- map.insert("guild_id".to_owned(), num.clone());
+ map.insert("guild_id".to_string(), num.clone());
}
}
}
diff --git a/src/model/gateway.rs b/src/model/gateway.rs
index 4edf0b8..4edc20e 100644
--- a/src/model/gateway.rs
+++ b/src/model/gateway.rs
@@ -60,7 +60,7 @@ impl Game {
pub fn playing(name: &str) -> Game {
Game {
kind: GameType::Playing,
- name: name.to_owned(),
+ name: name.to_string(),
url: None,
}
}
@@ -91,8 +91,8 @@ impl Game {
pub fn streaming(name: &str, url: &str) -> Game {
Game {
kind: GameType::Streaming,
- name: name.to_owned(),
- url: Some(url.to_owned()),
+ name: name.to_string(),
+ url: Some(url.to_string()),
}
}
}
diff --git a/src/model/guild/guild_id.rs b/src/model/guild/guild_id.rs
index 39b7dbb..4b9a713 100644
--- a/src/model/guild/guild_id.rs
+++ b/src/model/guild/guild_id.rs
@@ -374,7 +374,7 @@ impl GuildId {
where C: Into<ChannelId>, U: Into<UserId> {
let mut map = Map::new();
map.insert(
- "channel_id".to_owned(),
+ "channel_id".to_string(),
Value::Number(Number::from(channel_id.into().0)),
);
diff --git a/src/model/guild/mod.rs b/src/model/guild/mod.rs
index cec9e63..eef9d73 100644
--- a/src/model/guild/mod.rs
+++ b/src/model/guild/mod.rs
@@ -1073,7 +1073,7 @@ impl<'de> Deserialize<'de> for Guild {
for value in array {
if let Some(channel) = value.as_object_mut() {
channel
- .insert("guild_id".to_owned(), Value::Number(Number::from(guild_id)));
+ .insert("guild_id".to_string(), Value::Number(Number::from(guild_id)));
}
}
}
@@ -1082,7 +1082,7 @@ impl<'de> Deserialize<'de> for Guild {
for value in array {
if let Some(member) = value.as_object_mut() {
member
- .insert("guild_id".to_owned(), Value::Number(Number::from(guild_id)));
+ .insert("guild_id".to_string(), Value::Number(Number::from(guild_id)));
}
}
}
diff --git a/src/model/invite.rs b/src/model/invite.rs
index ba7521a..b4f326c 100644
--- a/src/model/invite.rs
+++ b/src/model/invite.rs
@@ -126,16 +126,16 @@ impl Invite {
/// # let invite = Invite {
/// # approximate_member_count: Some(1812),
/// # approximate_presence_count: Some(717),
- /// # code: "WxZumR".to_owned(),
+ /// # code: "WxZumR".to_string(),
/// # channel: InviteChannel {
/// # id: ChannelId(1),
- /// # name: "foo".to_owned(),
+ /// # name: "foo".to_string(),
/// # kind: ChannelType::Text,
/// # },
/// # guild: InviteGuild {
/// # id: GuildId(2),
/// # icon: None,
- /// # name: "bar".to_owned(),
+ /// # name: "bar".to_string(),
/// # splash_hash: None,
/// # text_channel_count: Some(7),
/// # voice_channel_count: Some(3),
@@ -290,17 +290,17 @@ impl RichInvite {
/// # use serenity::model::*;
/// #
/// # let invite = RichInvite {
- /// # code: "WxZumR".to_owned(),
+ /// # code: "WxZumR".to_string(),
/// # channel: InviteChannel {
/// # id: ChannelId(1),
- /// # name: "foo".to_owned(),
+ /// # name: "foo".to_string(),
/// # kind: ChannelType::Text,
/// # },
/// # created_at: "2017-01-29T15:35:17.136000+00:00".parse().unwrap(),
/// # guild: InviteGuild {
/// # id: GuildId(2),
/// # icon: None,
- /// # name: "baz".to_owned(),
+ /// # name: "baz".to_string(),
/// # splash_hash: None,
/// # text_channel_count: None,
/// # voice_channel_count: None,
@@ -310,7 +310,7 @@ impl RichInvite {
/// # bot: false,
/// # discriminator: 3,
/// # id: UserId(4),
- /// # name: "qux".to_owned(),
+ /// # name: "qux".to_string(),
/// # },
/// # max_age: 5,
/// # max_uses: 6,
diff --git a/src/model/user.rs b/src/model/user.rs
index b28997f..3ae33aa 100644
--- a/src/model/user.rs
+++ b/src/model/user.rs
@@ -85,10 +85,10 @@ impl CurrentUser {
pub fn edit<F>(&mut self, f: F) -> Result<()>
where F: FnOnce(EditProfile) -> EditProfile {
let mut map = Map::new();
- map.insert("username".to_owned(), Value::String(self.name.clone()));
+ map.insert("username".to_string(), Value::String(self.name.clone()));
if let Some(email) = self.email.as_ref() {
- map.insert("email".to_owned(), Value::String(email.clone()));
+ map.insert("email".to_string(), Value::String(email.clone()));
}
match http::edit_profile(&f(EditProfile(map)).0) {
diff --git a/src/model/webhook.rs b/src/model/webhook.rs
index 5e10d90..c8ae1b0 100644
--- a/src/model/webhook.rs
+++ b/src/model/webhook.rs
@@ -108,17 +108,17 @@ impl Webhook {
if let Some(avatar) = avatar {
map.insert(
- "avatar".to_owned(),
+ "avatar".to_string(),
if avatar.is_empty() {
Value::Null
} else {
- Value::String(avatar.to_owned())
+ Value::String(avatar.to_string())
},
);
}
if let Some(name) = name {
- map.insert("name".to_owned(), Value::String(name.to_owned()));
+ map.insert("name".to_string(), Value::String(name.to_string()));
}
match http::edit_webhook_with_token(self.id.0, &self.token, &map) {
diff --git a/src/utils/colour.rs b/src/utils/colour.rs
index a263019..72df2e9 100644
--- a/src/utils/colour.rs
+++ b/src/utils/colour.rs
@@ -37,7 +37,7 @@ macro_rules! colour {
/// # id: RoleId(1),
/// # managed: false,
/// # mentionable: false,
-/// # name: "test".to_owned(),
+/// # name: "test".to_string(),
/// # permissions: permissions::PRESET_GENERAL,
/// # position: 7,
/// # };
diff --git a/src/utils/message_builder.rs b/src/utils/message_builder.rs
index 2f714ec..f58c0b3 100644
--- a/src/utils/message_builder.rs
+++ b/src/utils/message_builder.rs
@@ -19,7 +19,7 @@ use model::{ChannelId, Emoji, Mentionable, RoleId, UserId};
/// # let user = UserId(1);
/// # let emoji = Emoji {
/// # id: EmojiId(2),
-/// # name: "test".to_owned(),
+/// # name: "test".to_string(),
/// # managed: false,
/// # require_colons: true,
/// # roles: vec![],
@@ -144,7 +144,7 @@ impl MessageBuilder {
/// let emoji = Emoji {
/// id: EmojiId(302516740095606785),
/// managed: true,
- /// name: "smugAnimeFace".to_owned(),
+ /// name: "smugAnimeFace".to_string(),
/// require_colons: true,
/// roles: vec![],
/// };
diff --git a/src/utils/mod.rs b/src/utils/mod.rs
index d81b0f9..4b36b73 100644
--- a/src/utils/mod.rs
+++ b/src/utils/mod.rs
@@ -259,7 +259,7 @@ pub fn parse_channel(mention: &str) -> Option<u64> {
///
/// let expected = EmojiIdentifier {
/// id: EmojiId(302516740095606785),
-/// name: "smugAnimeFace".to_owned(),
+/// name: "smugAnimeFace".to_string(),
/// };
///
/// assert_eq!(parse_emoji("<:smugAnimeFace:302516740095606785>").unwrap(), expected);
@@ -359,8 +359,8 @@ pub fn read_image<P: AsRef<Path>>(path: P) -> Result<String> {
///
/// let command = r#""this is the first" "this is the second""#;
/// let expected = vec![
-/// "this is the first".to_owned(),
-/// "this is the second".to_owned()
+/// "this is the first".to_string(),
+/// "this is the second".to_string()
/// ];
///
/// assert_eq!(parse_quotes(command), expected);
@@ -371,7 +371,7 @@ pub fn read_image<P: AsRef<Path>>(path: P) -> Result<String> {
///
/// let command = r#""this is a quoted command that doesn't have an ending quotation"#;
/// let expected = vec![
-/// "this is a quoted command that doesn't have an ending quotation".to_owned(),
+/// "this is a quoted command that doesn't have an ending quotation".to_string(),
/// ];
///
/// assert_eq!(parse_quotes(command), expected);
diff --git a/src/voice/handler.rs b/src/voice/handler.rs
index 24b3cd9..e09c292 100644
--- a/src/voice/handler.rs
+++ b/src/voice/handler.rs
@@ -306,7 +306,7 @@ impl Handler {
/// [`connect`]: #method.connect
/// [`standalone`]: #method.standalone
pub fn update_server(&mut self, endpoint: &Option<String>, token: &str) {
- self.token = Some(token.to_owned());
+ self.token = Some(token.to_string());
if let Some(endpoint) = endpoint.clone() {
self.endpoint = Some(endpoint);