aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLakelezz <[email protected]>2018-05-27 21:08:07 +0200
committerAlex M. M <[email protected]>2018-05-27 21:08:07 +0200
commit23c5398d8c6b0a3e5ad28cb43fadd48002195d3c (patch)
tree2b3806a9b8dd49959e05e724d524b00cd281dfb3 /src
parentRemove deadlocking in Member::highest_role_info (diff)
downloadserenity-23c5398d8c6b0a3e5ad28cb43fadd48002195d3c.tar.xz
serenity-23c5398d8c6b0a3e5ad28cb43fadd48002195d3c.zip
Check if cloning `unrecognised_command` is acceptable (#320)
Diffstat (limited to 'src')
-rw-r--r--src/framework/standard/mod.rs27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/framework/standard/mod.rs b/src/framework/standard/mod.rs
index f25f605..321abc6 100644
--- a/src/framework/standard/mod.rs
+++ b/src/framework/standard/mod.rs
@@ -10,18 +10,18 @@ mod buckets;
mod args;
pub use self::args::{
- Args,
- Iter,
+ Args,
+ Iter,
Error as ArgError
};
pub(crate) use self::buckets::{Bucket, Ratelimit};
pub(crate) use self::command::Help;
pub use self::command::{
- HelpFunction,
- HelpOptions,
- Command,
- CommandGroup,
- CommandOptions,
+ HelpFunction,
+ HelpOptions,
+ Command,
+ CommandGroup,
+ CommandOptions,
Error as CommandError
};
pub use self::command::CommandOrAlias;
@@ -948,7 +948,7 @@ impl StandardFramework {
/// Sets what code should be executed when a user sends `(prefix)help`.
///
/// If a command named `help` was set with [`command`], then this takes precendence first.
- ///
+ ///
/// [`command`]: #method.command
pub fn help(mut self, f: HelpFunction) -> Self {
let a = CreateHelpCommand(HelpOptions::default(), f).finish();
@@ -1119,13 +1119,12 @@ impl Framework for StandardFramework {
}
}
- let unrecognised_command = self.unrecognised_command.clone();
-
- threadpool.execute(move || {
- if let Some(unrecognised_command) = unrecognised_command {
+ if let Some(unrecognised_command) = &self.unrecognised_command {
+ let unrecognised_command = unrecognised_command.clone();
+ threadpool.execute(move || {
(unrecognised_command)(&mut context, &message, &unrecognised_command_name);
- }
- });
+ });
+ }
}
fn update_current_user(&mut self, user_id: UserId) {