aboutsummaryrefslogtreecommitdiff
path: root/src/framework
diff options
context:
space:
mode:
authorMei Boudreau <[email protected]>2017-10-19 22:50:38 -0400
committerZeyla Hellyer <[email protected]>2017-10-19 19:50:38 -0700
commitfbd625839e6a2e01b16e6c3814cb9b9f31dc7caa (patch)
tree060c08544ce6db71497ceb02c287d120d9d58b85 /src/framework
parentFix shard connection (diff)
downloadserenity-fbd625839e6a2e01b16e6c3814cb9b9f31dc7caa.tar.xz
serenity-fbd625839e6a2e01b16e6c3814cb9b9f31dc7caa.zip
Fix clippy warnings
Diffstat (limited to 'src/framework')
-rw-r--r--src/framework/standard/help_commands.rs31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/framework/standard/help_commands.rs b/src/framework/standard/help_commands.rs
index 0c018eb..5c1c58f 100644
--- a/src/framework/standard/help_commands.rs
+++ b/src/framework/standard/help_commands.rs
@@ -51,7 +51,7 @@ fn remove_aliases(cmds: &HashMap<String, CommandOrAlias>) -> HashMap<&String, &I
result
}
-/// Checks whether a user is member of required roles
+/// Checks whether a user is member of required roles
/// and given the required permissions.
pub fn has_all_requirements(cmd: &Command, msg: &Message) -> bool {
if let Some(guild) = msg.guild() {
@@ -62,9 +62,9 @@ pub fn has_all_requirements(cmd: &Command, msg: &Message) -> bool {
if let Ok(permissions) = member.permissions() {
if cmd.allowed_roles.is_empty() {
- return permissions.administrator() || has_correct_permissions(&cmd, &msg);
+ return permissions.administrator() || has_correct_permissions(cmd, msg);
} else {
- return permissions.administrator() || (has_correct_roles(&cmd, &guild, &member) && has_correct_permissions(cmd, msg));
+ return permissions.administrator() || (has_correct_roles(cmd, &guild, member) && has_correct_permissions(cmd, msg));
}
}
}
@@ -111,19 +111,19 @@ pub fn with_embeds(_: &mut Context,
if name == with_prefix || name == *command_name {
match *command {
CommandOrAlias::Command(ref cmd) => {
- if has_all_requirements(&cmd, &msg) {
+ if has_all_requirements(cmd, msg) {
found = Some((command_name, cmd));
}
else {
break;
- }
+ }
},
CommandOrAlias::Alias(ref name) => {
- let actual_command = group.commands.get(name).unwrap();
+ let actual_command = &group.commands[name];
match *actual_command {
CommandOrAlias::Command(ref cmd) => {
- if has_all_requirements(&cmd, &msg) {
+ if has_all_requirements(cmd, msg) {
found = Some((name, cmd));
}
else {
@@ -230,12 +230,9 @@ pub fn with_embeds(_: &mut Context,
for name in command_names {
let cmd = &commands[name];
- if cmd.help_available {
-
- if cmd.help_available && has_all_requirements(&cmd, &msg) {
- let _ = write!(desc, "`{}`\n", name);
- has_commands = true;
- }
+ if cmd.help_available && has_all_requirements(cmd, msg) {
+ let _ = write!(desc, "`{}`\n", name);
+ has_commands = true;
}
}
@@ -289,7 +286,7 @@ pub fn plain(_: &mut Context,
if name == with_prefix || name == *command_name {
match *command {
CommandOrAlias::Command(ref cmd) => {
- if has_all_requirements(&cmd, &msg) {
+ if has_all_requirements(cmd, msg) {
found = Some((command_name, cmd));
}
else {
@@ -297,11 +294,11 @@ pub fn plain(_: &mut Context,
}
},
CommandOrAlias::Alias(ref name) => {
- let actual_command = group.commands.get(name).unwrap();
+ let actual_command = &group.commands[name];
match *actual_command {
CommandOrAlias::Command(ref cmd) => {
- if has_all_requirements(&cmd, &msg) {
+ if has_all_requirements(cmd, msg) {
found = Some((name, cmd));
}
else {
@@ -390,7 +387,7 @@ pub fn plain(_: &mut Context,
for name in command_names {
let cmd = &commands[name];
- if cmd.help_available && has_all_requirements(&cmd, &msg) {
+ if cmd.help_available && has_all_requirements(cmd, msg) {
let _ = write!(group_help, "`{}` ", name);
}
}