diff options
| author | acdenisSK <[email protected]> | 2017-08-01 10:54:32 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-08-01 10:54:32 +0200 |
| commit | 3f9db73a3c193eecfac142ecc40c48d9e4140591 (patch) | |
| tree | 4e361f176e09319cd3b94c7896ee850b896c4dc6 /src/framework | |
| parent | Provide the input and limit back to the user, and do some consistencies (diff) | |
| download | serenity-3f9db73a3c193eecfac142ecc40c48d9e4140591.tar.xz serenity-3f9db73a3c193eecfac142ecc40c48d9e4140591.zip | |
Clippy and rustfmt
Diffstat (limited to 'src/framework')
| -rw-r--r-- | src/framework/mod.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/framework/mod.rs b/src/framework/mod.rs index bc6afbd..9206040 100644 --- a/src/framework/mod.rs +++ b/src/framework/mod.rs @@ -214,7 +214,6 @@ type DispatchErrorHook = Fn(Context, Message, DispatchError) + 'static; /// Refer to the [module-level documentation] for more information. /// /// [module-level documentation]: index.html -#[allow(type_complexity)] #[derive(Default)] pub struct BuiltinFramework { configuration: Configuration, @@ -518,13 +517,15 @@ impl BuiltinFramework { if let Some(ref mut bucket) = self.buckets.get_mut(bucket) { let rate_limit = bucket.take(message.author.id.0); match bucket.check { - Some(ref check) => if feature_cache! {{ + Some(ref check) => { + let apply = feature_cache! {{ let guild_id = message.guild_id(); (check)(context, guild_id, message.channel_id, message.author.id) } else { (check)(context, message.channel_id, message.author.id) - }} { - if rate_limit > 0i64 { + }}; + + if apply && rate_limit > 0i64 { return Some(DispatchError::RateLimited(rate_limit)); } }, |