aboutsummaryrefslogtreecommitdiff
path: root/src/framework
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/framework
parentHave `ConnectionStage` derive Copy (diff)
downloadserenity-0ce8be869eeb2eb700e22f71b2e00872cc96a500.tar.xz
serenity-0ce8be869eeb2eb700e22f71b2e00872cc96a500.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 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;
}