aboutsummaryrefslogtreecommitdiff
path: root/src/framework
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-10-01 21:59:33 +0200
committeracdenisSK <[email protected]>2017-10-01 22:14:23 +0200
commit1bf4d9cb9823dca8c4bb77147c66eac2d53f609f (patch)
treeba14ca714fa7bc1e6ba1d26f10e7c170bdf10ffa /src/framework
parentHave `ConnectionStage` derive Copy (diff)
downloadserenity-1bf4d9cb9823dca8c4bb77147c66eac2d53f609f.tar.xz
serenity-1bf4d9cb9823dca8c4bb77147c66eac2d53f609f.zip
`to_owned` -> `to_string`
Diffstat (limited to 'src/framework')
-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
5 files changed, 26 insertions, 26 deletions
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 423d982..c81c57a 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
}
@@ -141,7 +141,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
}
@@ -162,7 +162,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
}
@@ -206,7 +206,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 699e56f..7b9468d 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)),
);
@@ -77,7 +77,7 @@ impl CreateGroup {
self.0
.commands
- .insert(command_name.to_owned(), CommandOrAlias::Command(cmd));
+ .insert(command_name.to_string(), CommandOrAlias::Command(cmd));
self
}
@@ -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 ec45a95..92572dd 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 {
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) {
@@ -633,7 +633,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) {
@@ -651,7 +651,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()));
}
}
@@ -873,12 +873,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;
}