diff options
| author | acdenisSK <[email protected]> | 2017-07-04 23:19:13 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-07-04 23:19:13 +0200 |
| commit | fbc1ac740e769e624637c490b6a959ed86ec3839 (patch) | |
| tree | cc2d51d7cc7d0f0b6ca8eb5fb7d9bac77b5b91dd /src/framework | |
| parent | Add a macro here (diff) | |
| download | serenity-fbc1ac740e769e624637c490b6a959ed86ec3839.tar.xz serenity-fbc1ac740e769e624637c490b6a959ed86ec3839.zip | |
Remove `checks_passed` in favour of the `Iterator::all` method
Diffstat (limited to 'src/framework')
| -rw-r--r-- | src/framework/mod.rs | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/framework/mod.rs b/src/framework/mod.rs index a521b13..c3b683e 100644 --- a/src/framework/mod.rs +++ b/src/framework/mod.rs @@ -437,16 +437,6 @@ impl Framework { true } - fn checks_passed(&self, command: &Arc<Command>, mut context: &mut Context, message: &Message) -> bool { - for check in &command.checks { - if !(check)(&mut context, message) { - return false; - } - } - - true - } - #[allow(too_many_arguments)] fn should_fail(&mut self, mut context: &mut Context, @@ -508,7 +498,7 @@ impl Framework { if command.owners_only { Some(DispatchError::OnlyForOwners) - } else if !self.checks_passed(command, &mut context, message) { + } else if !command.checks.iter().all(|check| (check)(&mut context, message)) { Some(DispatchError::CheckFailed) } else if self.configuration.blocked_users.contains(&message.author.id) { Some(DispatchError::BlockedUser) |