From 9dc04164b4f72a86e06a18d49292b04c7ccc964a Mon Sep 17 00:00:00 2001 From: Zeyla Hellyer Date: Fri, 18 Aug 2017 17:49:57 -0700 Subject: Clippy lints --- src/framework/mod.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/framework') diff --git a/src/framework/mod.rs b/src/framework/mod.rs index a3a9447..795dee0 100644 --- a/src/framework/mod.rs +++ b/src/framework/mod.rs @@ -605,10 +605,6 @@ impl BuiltinFramework { if command.owners_only { Some(DispatchError::OnlyForOwners) - } else if !command.checks.iter().all(|check| { - (check)(&mut context, message, args, command) - }) { - Some(DispatchError::CheckFailed(command.to_owned())) } else if self.configuration.blocked_users.contains( &message.author.id, ) { @@ -618,7 +614,15 @@ impl BuiltinFramework { } else if self.configuration.disabled_commands.contains(built) { Some(DispatchError::CommandDisabled(built.to_owned())) } else { - None + let all_passed = command.checks.iter().all(|check| { + check(&mut context, message, args, command) + }); + + if all_passed { + None + } else { + Some(DispatchError::CheckFailed(command.to_owned())) + } } } } @@ -983,10 +987,10 @@ impl Framework for BuiltinFramework { ( regex .split(content) - .filter_map(|p| if !p.is_empty() { - Some(p.to_string()) - } else { + .filter_map(|p| if p.is_empty() { None + } else { + Some(p.to_string()) }) .collect::>(), content.to_string(), -- cgit v1.2.3