diff options
| author | acdenisSK <[email protected]> | 2017-07-27 08:10:41 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-07-27 08:10:41 +0200 |
| commit | 70b5097aaac85f970c32ceb988dbb5f5d575ee0f (patch) | |
| tree | d2f391d3b552cfae58b74748a2a2aa5ae80c7986 /src/framework/create_group.rs | |
| parent | rustfmt (diff) | |
| download | serenity-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.rs | 31 |
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 |