From fbc1ac740e769e624637c490b6a959ed86ec3839 Mon Sep 17 00:00:00 2001 From: acdenisSK Date: Tue, 4 Jul 2017 23:19:13 +0200 Subject: Remove `checks_passed` in favour of the `Iterator::all` method --- src/framework/mod.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src/framework') 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, 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) -- cgit v1.2.3