aboutsummaryrefslogtreecommitdiff
path: root/src/framework/create_group.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-07-27 08:10:41 +0200
committeracdenisSK <[email protected]>2017-07-27 08:10:41 +0200
commit70b5097aaac85f970c32ceb988dbb5f5d575ee0f (patch)
treed2f391d3b552cfae58b74748a2a2aa5ae80c7986 /src/framework/create_group.rs
parentrustfmt (diff)
downloadserenity-70b5097aaac85f970c32ceb988dbb5f5d575ee0f.tar.xz
serenity-70b5097aaac85f970c32ceb988dbb5f5d575ee0f.zip
Change the config a bit, and a few nitpicks
Diffstat (limited to 'src/framework/create_group.rs')
-rw-r--r--src/framework/create_group.rs31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/framework/create_group.rs b/src/framework/create_group.rs
index d5b68c3..5c36e4d 100644
--- a/src/framework/create_group.rs
+++ b/src/framework/create_group.rs
@@ -27,26 +27,27 @@ pub struct CreateGroup(pub CommandGroup);
impl CreateGroup {
/// Adds a command to group.
pub fn command<F>(mut self, command_name: &str, f: F) -> Self
- where
- F: FnOnce(CreateCommand) -> CreateCommand, {
+ where F: FnOnce(CreateCommand) -> CreateCommand {
let cmd = f(CreateCommand(Command::default())).0;
for n in &cmd.aliases {
if let Some(ref prefix) = self.0.prefix {
- self.0
- .commands
- .insert(format!("{} {}", prefix, n.to_owned()),
- CommandOrAlias::Alias(format!("{} {}",
- prefix,
- command_name.to_string())));
+ self.0.commands.insert(
+ format!("{} {}", prefix, n.to_owned()),
+ CommandOrAlias::Alias(format!("{} {}", prefix, command_name.to_string())),
+ );
} else {
- self.0.commands.insert(n.to_owned(),
- CommandOrAlias::Alias(command_name.to_string()));
+ self.0.commands.insert(
+ n.to_owned(),
+ CommandOrAlias::Alias(command_name.to_string()),
+ );
}
}
- self.0.commands.insert(command_name.to_owned(),
- CommandOrAlias::Command(Arc::new(cmd)));
+ self.0.commands.insert(
+ command_name.to_owned(),
+ CommandOrAlias::Command(Arc::new(cmd)),
+ );
self
}
@@ -54,8 +55,10 @@ impl CreateGroup {
/// Adds a command to group with simplified API.
/// You can return Err(string) if there's an error.
pub fn on<F>(mut self, command_name: &str, f: F) -> Self
- where
- F: Fn(&mut Context, &Message, Vec<String>) -> Result<(), String> + Send + Sync + 'static, {
+ where F: Fn(&mut Context, &Message, Vec<String>) -> Result<(), String>
+ + Send
+ + Sync
+ + 'static {
let cmd = Arc::new(Command::new(f));
self.0