aboutsummaryrefslogtreecommitdiff
path: root/src/framework
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-08-18 17:49:57 -0700
committerZeyla Hellyer <[email protected]>2017-08-18 17:53:13 -0700
commit9dc04164b4f72a86e06a18d49292b04c7ccc964a (patch)
treef7b39dc97f9d3392c9710ce50666ea109fb916c6 /src/framework
parenttravis: simplify caching config (diff)
downloadserenity-9dc04164b4f72a86e06a18d49292b04c7ccc964a.tar.xz
serenity-9dc04164b4f72a86e06a18d49292b04c7ccc964a.zip
Clippy lints
Diffstat (limited to 'src/framework')
-rw-r--r--src/framework/mod.rs20
1 files changed, 12 insertions, 8 deletions
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::<Vec<_>>(),
content.to_string(),